mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[vhd] fix VHDX being inadvertently saved as VHD
* Addresses the error reported in #2468. * Also use memmove instead of memcpy where overlapping data is involved.
This commit is contained in:
parent
fb43dc8957
commit
45423becd5
3 changed files with 10 additions and 9 deletions
|
@ -1514,7 +1514,7 @@ int sanitize_label(char* label)
|
||||||
// Remove all leading '-'
|
// Remove all leading '-'
|
||||||
for (i = 0; i < len && label[i] == '-'; i++);
|
for (i = 0; i < len && label[i] == '-'; i++);
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
memcpy(label, &label[i], len - i);
|
memmove(label, &label[i], len - i);
|
||||||
len = strlen(label);
|
len = strlen(label);
|
||||||
if (len <= 1)
|
if (len <= 1)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1529,7 +1529,7 @@ int sanitize_label(char* label)
|
||||||
// Remove all duplicate '-' (non-optimized!)
|
// Remove all duplicate '-' (non-optimized!)
|
||||||
for (i = 0; len >= 2 && i < len - 2; i++) {
|
for (i = 0; len >= 2 && i < len - 2; i++) {
|
||||||
if (label[i] == '-' && label[i + 1] == '-') {
|
if (label[i] == '-' && label[i + 1] == '-') {
|
||||||
memcpy(&label[i + 1], &label[i + 2], len - i - 1);
|
memmove(&label[i + 1], &label[i + 2], len - i - 1);
|
||||||
len--;
|
len--;
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
|
|
10
src/rufus.rc
10
src/rufus.rc
|
@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||||
IDD_DIALOG DIALOGEX 12, 12, 232, 326
|
IDD_DIALOG DIALOGEX 12, 12, 232, 326
|
||||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
EXSTYLE WS_EX_ACCEPTFILES
|
EXSTYLE WS_EX_ACCEPTFILES
|
||||||
CAPTION "Rufus 4.5.2169"
|
CAPTION "Rufus 4.5.2170"
|
||||||
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
|
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
|
||||||
BEGIN
|
BEGIN
|
||||||
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
|
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
|
||||||
|
@ -397,8 +397,8 @@ END
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 4,5,2169,0
|
FILEVERSION 4,5,2170,0
|
||||||
PRODUCTVERSION 4,5,2169,0
|
PRODUCTVERSION 4,5,2170,0
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -416,13 +416,13 @@ BEGIN
|
||||||
VALUE "Comments", "https://rufus.ie"
|
VALUE "Comments", "https://rufus.ie"
|
||||||
VALUE "CompanyName", "Akeo Consulting"
|
VALUE "CompanyName", "Akeo Consulting"
|
||||||
VALUE "FileDescription", "Rufus"
|
VALUE "FileDescription", "Rufus"
|
||||||
VALUE "FileVersion", "4.5.2169"
|
VALUE "FileVersion", "4.5.2170"
|
||||||
VALUE "InternalName", "Rufus"
|
VALUE "InternalName", "Rufus"
|
||||||
VALUE "LegalCopyright", "<22> 2011-2024 Pete Batard (GPL v3)"
|
VALUE "LegalCopyright", "<22> 2011-2024 Pete Batard (GPL v3)"
|
||||||
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
|
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
|
||||||
VALUE "OriginalFilename", "rufus-4.5.exe"
|
VALUE "OriginalFilename", "rufus-4.5.exe"
|
||||||
VALUE "ProductName", "Rufus"
|
VALUE "ProductName", "Rufus"
|
||||||
VALUE "ProductVersion", "4.5.2169"
|
VALUE "ProductVersion", "4.5.2170"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
|
@ -1148,8 +1148,9 @@ void VhdSaveImage(void)
|
||||||
img_save.ImagePath = FileDialog(TRUE, NULL, &img_ext, &i);
|
img_save.ImagePath = FileDialog(TRUE, NULL, &img_ext, &i);
|
||||||
if (img_save.ImagePath == NULL)
|
if (img_save.ImagePath == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
for (i = 1; i <= (UINT)img_ext.count && (strstr(img_save.ImagePath, &_img_ext_x[i - 1][1]) == NULL); i++);
|
// Start from the end of our extension array, since '.vhd' would match for '.vhdx' otherwise
|
||||||
if (i > (UINT)img_ext.count) {
|
for (i = (UINT)img_ext.count; (i > 0) && (strstr(img_save.ImagePath, &_img_ext_x[i - 1][1]) == NULL); i--);
|
||||||
|
if (i == 0) {
|
||||||
uprintf("Warning: Can not determine image type from extension - Saving to uncompressed VHD.");
|
uprintf("Warning: Can not determine image type from extension - Saving to uncompressed VHD.");
|
||||||
i = image_type_vhd;
|
i = image_type_vhd;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue