mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-07-10 13:29:52 -04:00
rbutilqt: Replace insecure sprintf() with snprintf()
Co-authored-by: ChatGPT (GPT-5.3 Mini) <chatgpt@openai.com> Change-Id: Ic2abe417f17a6f104cc4523b155ca6fdb5965bb1
This commit is contained in:
parent
e3e416c51b
commit
cf2872af11
2 changed files with 7 additions and 6 deletions
|
|
@ -242,12 +242,12 @@ bool BootloaderInstallIpod::ipodInitialize(struct ipod_t *ipod)
|
|||
return false;
|
||||
}
|
||||
#if defined(Q_OS_WIN32)
|
||||
sprintf(ipod->diskname, "\\\\.\\PhysicalDrive%i", devicename.toInt());
|
||||
snprintf(ipod->diskname, sizeof(ipod->diskname), "\\\\.\\PhysicalDrive%i", devicename.toInt());
|
||||
#elif defined(Q_OS_MACOS)
|
||||
sprintf(ipod->diskname, "%s",
|
||||
snprintf(ipod->diskname, sizeof(ipod->diskname), "%s",
|
||||
qPrintable(devicename.remove(QRegularExpression("s[0-9]+$"))));
|
||||
#else
|
||||
sprintf(ipod->diskname, "%s",
|
||||
snprintf(ipod->diskname, sizeof(ipod->diskname), "%s",
|
||||
qPrintable(devicename.remove(QRegularExpression("[0-9]+$"))));
|
||||
#endif
|
||||
LOG_INFO() << "ipodpatcher: overriding scan, using"
|
||||
|
|
|
|||
|
|
@ -245,12 +245,13 @@ bool BootloaderInstallSansa::sansaInitialize(struct sansa_t *sansa)
|
|||
return false;
|
||||
}
|
||||
#if defined(Q_OS_WIN32)
|
||||
sprintf(sansa->diskname, "\\\\.\\PhysicalDrive%i", devicename.toInt());
|
||||
snprintf(sansa->diskname, sizeof(sansa->diskname),
|
||||
"\\\\.\\PhysicalDrive%i", devicename.toInt());
|
||||
#elif defined(Q_OS_MACOS)
|
||||
sprintf(sansa->diskname,
|
||||
snprintf(sansa->diskname, sizeof(sansa->diskname),
|
||||
"%s", qPrintable(devicename.remove(QRegularExpression("s[0-9]+$"))));
|
||||
#else
|
||||
sprintf(sansa->diskname,
|
||||
snprintf(sansa->diskname, sizeof(sansa->diskname),
|
||||
"%s", qPrintable(devicename.remove(QRegularExpression("[0-9]+$"))));
|
||||
#endif
|
||||
LOG_INFO() << "sansapatcher: overriding scan, using"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue