mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[core] fix potential invalid label for non western locales
* If a converted label contains mostly underscore, the proposed label is used for FAT32 instead. However this label still has the KB/MB/GB symbols localized so it may be invalid. * Ensure that we use a non-localized version of the size when using such a label. * Closes #1506. * Also fix a VS2019 static analysis warning in net.c.
This commit is contained in:
parent
2442aaf76f
commit
3c75ca92b4
3 changed files with 15 additions and 9 deletions
13
src/format.c
13
src/format.c
|
@ -252,6 +252,7 @@ static void ToValidLabel(char* Label, BOOL bFAT)
|
|||
BOOL found;
|
||||
const WCHAR unauthorized[] = L"*?,;:/\\|+=<>[]\"";
|
||||
const WCHAR to_underscore[] = L"\t.";
|
||||
char label[16] = { 0 };
|
||||
WCHAR *wLabel = utf8_to_wchar(Label);
|
||||
|
||||
if (wLabel == NULL)
|
||||
|
@ -295,11 +296,15 @@ static void ToValidLabel(char* Label, BOOL bFAT)
|
|||
if (wLabel[i] == '_')
|
||||
j++;
|
||||
if (i < 2*j) {
|
||||
// If the final label is mostly underscore, use the proposed label
|
||||
uprintf("FAT label is mostly underscores. Using '%s' label instead.", SelectedDrive.proposed_label);
|
||||
for(i = 0; SelectedDrive.proposed_label[i] != 0; i++)
|
||||
wLabel[i] = SelectedDrive.proposed_label[i];
|
||||
// If the final label is mostly underscore, use an alternate label according to the
|
||||
// size (eg: "256 MB", "7.9 GB"). Note that we can't use SelectedDrive.proposed_label
|
||||
// here as it may contain localized character for GB or MB, so make sure that the
|
||||
// effective label we use is an English one, and also make sure we convert the dot.
|
||||
static_sprintf(label, "%s", SizeToHumanReadable(SelectedDrive.DiskSize, TRUE, FALSE));
|
||||
for (i = 0; label[i] != 0; i++)
|
||||
wLabel[i] = (label[i] == '.') ? '_' : label[i];
|
||||
wLabel[i] = 0;
|
||||
uprintf("FAT label is mostly underscores. Using '%S' label instead.", wLabel);
|
||||
}
|
||||
} else if (wcslen(wLabel) > 32) {
|
||||
wLabel[32] = 0;
|
||||
|
|
|
@ -240,6 +240,7 @@ static char* GetShortName(const char* url)
|
|||
break;
|
||||
}
|
||||
}
|
||||
memset(short_name, 0, sizeof(short_name));
|
||||
static_strcpy(short_name, &url[i]);
|
||||
// If the URL is followed by a query, remove that part
|
||||
// Make sure we detect escaped queries too
|
||||
|
|
10
src/rufus.rc
10
src/rufus.rc
|
@ -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 3.10.1635"
|
||||
CAPTION "Rufus 3.10.1636"
|
||||
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
|
||||
|
@ -395,8 +395,8 @@ END
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 3,10,1635,0
|
||||
PRODUCTVERSION 3,10,1635,0
|
||||
FILEVERSION 3,10,1636,0
|
||||
PRODUCTVERSION 3,10,1636,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -414,13 +414,13 @@ BEGIN
|
|||
VALUE "Comments", "https://rufus.ie"
|
||||
VALUE "CompanyName", "Akeo Consulting"
|
||||
VALUE "FileDescription", "Rufus"
|
||||
VALUE "FileVersion", "3.10.1635"
|
||||
VALUE "FileVersion", "3.10.1636"
|
||||
VALUE "InternalName", "Rufus"
|
||||
VALUE "LegalCopyright", "© 2011-2020 Pete Batard (GPL v3)"
|
||||
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
|
||||
VALUE "OriginalFilename", "rufus-3.10.exe"
|
||||
VALUE "ProductName", "Rufus"
|
||||
VALUE "ProductVersion", "3.10.1635"
|
||||
VALUE "ProductVersion", "3.10.1636"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
Loading…
Reference in a new issue