diff --git a/src/ARMJIT_Memory.cpp b/src/ARMJIT_Memory.cpp index 51e022d180..2a1041042f 100644 --- a/src/ARMJIT_Memory.cpp +++ b/src/ARMJIT_Memory.cpp @@ -717,7 +717,7 @@ ARMJIT_Memory::ARMJIT_Memory(melonDS::NDS& nds) : NDS(nds) } #else char fastmemPidName[snprintf(NULL, 0, "/melondsfastmem%d", getpid()) + 1]; - sprintf(fastmemPidName, "/melondsfastmem%d", getpid()); + snprintf(fastmemPidName, sizeof(fastmemPidName), "/melondsfastmem%d", getpid()); MemoryFile = shm_open(fastmemPidName, O_RDWR | O_CREAT | O_EXCL, 0600); if (MemoryFile == -1) { @@ -1432,4 +1432,4 @@ void* ARMJIT_Memory::GetFuncForAddr(ARM* cpu, u32 addr, bool store, int size) co } return NULL; } -} \ No newline at end of file +} diff --git a/src/frontend/qt_sdl/EmuThread.cpp b/src/frontend/qt_sdl/EmuThread.cpp index f767c6db4b..d7b36e9373 100644 --- a/src/frontend/qt_sdl/EmuThread.cpp +++ b/src/frontend/qt_sdl/EmuThread.cpp @@ -428,9 +428,9 @@ void EmuThread::run() double actualfps = (59.8261 * 263.0) / nlines; int inst = emuInstance->instanceID; if (inst == 0) - sprintf(melontitle, "[%d/%.0f] melonDS " MELONDS_VERSION, fps, actualfps); + snprintf(melontitle, sizeof(melontitle), "[%d/%.0f] melonDS " MELONDS_VERSION, fps, actualfps); else - sprintf(melontitle, "[%d/%.0f] melonDS (%d)", fps, fpstarget, inst+1); + snprintf(melontitle, sizeof(melontitle), "[%d/%.0f] melonDS (%d)", fps, fpstarget, inst+1); changeWindowTitle(melontitle); } } @@ -445,9 +445,9 @@ void EmuThread::run() int inst = emuInstance->instanceID; if (inst == 0) - sprintf(melontitle, "melonDS " MELONDS_VERSION); + snprintf(melontitle, sizeof(melontitle), "melonDS " MELONDS_VERSION); else - sprintf(melontitle, "melonDS (%d)", inst+1); + snprintf(melontitle, sizeof(melontitle), "melonDS (%d)", inst+1); changeWindowTitle(melontitle); SDL_Delay(75); diff --git a/src/frontend/qt_sdl/NetplayDialog.cpp b/src/frontend/qt_sdl/NetplayDialog.cpp index d7b7cf8166..3657eef8ca 100644 --- a/src/frontend/qt_sdl/NetplayDialog.cpp +++ b/src/frontend/qt_sdl/NetplayDialog.cpp @@ -187,7 +187,7 @@ void NetplayDialog::doUpdatePlayerList(Netplay::Player* players, int num) char ip[32]; u32 addr = player->Address; - sprintf(ip, "%d.%d.%d.%d", addr&0xFF, (addr>>8)&0xFF, (addr>>16)&0xFF, addr>>24); + snprintf(ip, sizeof(ip), "%d.%d.%d.%d", addr&0xFF, (addr>>8)&0xFF, (addr>>16)&0xFF, addr>>24); model->setItem(i, 4, new QStandardItem(ip)); } } diff --git a/src/frontend/qt_sdl/TitleManagerDialog.cpp b/src/frontend/qt_sdl/TitleManagerDialog.cpp index 30f29d24f4..ef6157e88a 100644 --- a/src/frontend/qt_sdl/TitleManagerDialog.cpp +++ b/src/frontend/qt_sdl/TitleManagerDialog.cpp @@ -125,7 +125,7 @@ void TitleManagerDialog::createTitleItem(u32 category, u32 titleid) *(u32*)&gamecode[0] = *(u32*)&header.GameCode[0]; gamecode[4] = '\0'; char extra[128]; - sprintf(extra, "\n(title ID: %s · %08x/%08x · version %08x)", gamecode, category, titleid, version); + snprintf(extra, sizeof(extra), "\n(title ID: %s · %08x/%08x · version %08x)", gamecode, category, titleid, version); QListWidgetItem* item = new QListWidgetItem(title + QString(extra)); item->setIcon(icon); @@ -481,7 +481,7 @@ void TitleImportDialog::accept() network = new QNetworkAccessManager(this); char url[256]; - sprintf(url, "http://nus.cdn.t.shop.nintendowifi.net/ccs/download/%08x%08x/tmd", titleid[1], titleid[0]); + snprintf(url, sizeof(url), "http://nus.cdn.t.shop.nintendowifi.net/ccs/download/%08x%08x/tmd", titleid[1], titleid[0]); QNetworkRequest req; req.setUrl(QUrl(url)); diff --git a/src/frontend/qt_sdl/WifiSettingsDialog.cpp b/src/frontend/qt_sdl/WifiSettingsDialog.cpp index e0954c83b0..e041234b51 100644 --- a/src/frontend/qt_sdl/WifiSettingsDialog.cpp +++ b/src/frontend/qt_sdl/WifiSettingsDialog.cpp @@ -152,14 +152,14 @@ void WifiSettingsDialog::on_cbxDirectAdapter_currentIndexChanged(int sel) melonDS::AdapterData* adapter = &adapters[sel]; char tmp[64]; - sprintf(tmp, "%02X:%02X:%02X:%02X:%02X:%02X", - adapter->MAC[0], adapter->MAC[1], adapter->MAC[2], - adapter->MAC[3], adapter->MAC[4], adapter->MAC[5]); + snprintf(tmp, sizeof(tmp), "%02X:%02X:%02X:%02X:%02X:%02X", + adapter->MAC[0], adapter->MAC[1], adapter->MAC[2], + adapter->MAC[3], adapter->MAC[4], adapter->MAC[5]); ui->lblAdapterMAC->setText(QString(tmp)); - sprintf(tmp, "%d.%d.%d.%d", - adapter->IP_v4[0], adapter->IP_v4[1], - adapter->IP_v4[2], adapter->IP_v4[3]); + snprintf(tmp, sizeof(tmp), "%d.%d.%d.%d", + adapter->IP_v4[0], adapter->IP_v4[1], + adapter->IP_v4[2], adapter->IP_v4[3]); ui->lblAdapterIP->setText(QString(tmp)); }