1
0
mirror of https://github.com/pbatard/rufus.git synced 2026-10-24 02:28:58 +03:00

[core] fix two small label sanitisation issues

* memmove(label, &label[i], len - i) is missing the copy of the NUL terminator due to size being 1 char too small.
* strcpy(s, &s[strlen(remove[i])]) can have overlapped content which is undefined behaviour, so use memmove() instead.
* Closes #2992, with thanks to @christian8641.
This commit is contained in:
Pete Batard
2026-06-14 12:58:39 +01:00
parent f23e6c5f7f
commit b841090800
2 changed files with 7 additions and 7 deletions

View File

@@ -1578,7 +1578,7 @@ int sanitize_label(char* label)
// Remove all leading '-'
for (i = 0; i < len && label[i] == '-'; i++);
if (i != 0)
memmove(label, &label[i], len - i);
memmove(label, &label[i], len - i + 1);
len = strlen(label);
if (len <= 1)
return -1;
@@ -1603,7 +1603,7 @@ int sanitize_label(char* label)
for (i = 0; i < ARRAYSIZE(remove); i++) {
s = strstr(label, remove[i]);
if (s != NULL)
strcpy(s, &s[strlen(remove[i])]);
memmove(s, &s[strlen(remove[i])], strlen(&s[strlen(remove[i])]) + 1);
}
return 0;

View File

@@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 4.15.2386"
CAPTION "Rufus 4.15.2387"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@@ -409,8 +409,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,15,2386,0
PRODUCTVERSION 4,15,2386,0
FILEVERSION 4,15,2387,0
PRODUCTVERSION 4,15,2387,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -428,13 +428,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "4.15.2386"
VALUE "FileVersion", "4.15.2387"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2026 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-4.15.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "4.15.2386"
VALUE "ProductVersion", "4.15.2387"
END
END
BLOCK "VarFileInfo"