mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[core] fix 'Bad label' errors with empty labels
* Only happens on Win7 due to MinGW not automatically initializing variables to zero on that platform. * Root of the problem was that GetWindowTextU() did not properly handle empty text controls, due to GetWindowTextW() returning 0 on empty strings. As a result, the UTF-8 label was not properly set to the empty string, but kept whatever data it contained, which is garbage on Windows 7 and resulted in an invalid label (even after sanitizing, since we don't sanitize low-level ASCII characters). * Closes #1352
This commit is contained in:
parent
c8fda3e4e8
commit
307e2f7075
2 changed files with 8 additions and 5 deletions
|
@ -329,6 +329,9 @@ static __inline int GetWindowTextU(HWND hWnd, char* lpString, int nMaxCount)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
DWORD err = ERROR_INVALID_DATA;
|
DWORD err = ERROR_INVALID_DATA;
|
||||||
|
// Handle the empty string as GetWindowTextW() returns 0 then
|
||||||
|
if ((lpString != NULL) && (nMaxCount > 0))
|
||||||
|
lpString[0] = 0;
|
||||||
// coverity[returned_null]
|
// coverity[returned_null]
|
||||||
walloc(lpString, nMaxCount);
|
walloc(lpString, nMaxCount);
|
||||||
ret = GetWindowTextW(hWnd, wlpString, nMaxCount);
|
ret = GetWindowTextW(hWnd, wlpString, nMaxCount);
|
||||||
|
|
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 3.7.1553"
|
CAPTION "Rufus 3.7.1554"
|
||||||
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
|
||||||
|
@ -394,8 +394,8 @@ END
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 3,7,1553,0
|
FILEVERSION 3,7,1554,0
|
||||||
PRODUCTVERSION 3,7,1553,0
|
PRODUCTVERSION 3,7,1554,0
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -413,13 +413,13 @@ BEGIN
|
||||||
VALUE "Comments", "https://akeo.ie"
|
VALUE "Comments", "https://akeo.ie"
|
||||||
VALUE "CompanyName", "Akeo Consulting"
|
VALUE "CompanyName", "Akeo Consulting"
|
||||||
VALUE "FileDescription", "Rufus"
|
VALUE "FileDescription", "Rufus"
|
||||||
VALUE "FileVersion", "3.7.1553"
|
VALUE "FileVersion", "3.7.1554"
|
||||||
VALUE "InternalName", "Rufus"
|
VALUE "InternalName", "Rufus"
|
||||||
VALUE "LegalCopyright", "© 2011-2019 Pete Batard (GPL v3)"
|
VALUE "LegalCopyright", "© 2011-2019 Pete Batard (GPL v3)"
|
||||||
VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html"
|
VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html"
|
||||||
VALUE "OriginalFilename", "rufus-3.7.exe"
|
VALUE "OriginalFilename", "rufus-3.7.exe"
|
||||||
VALUE "ProductName", "Rufus"
|
VALUE "ProductName", "Rufus"
|
||||||
VALUE "ProductVersion", "3.7.1553"
|
VALUE "ProductVersion", "3.7.1554"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
Loading…
Reference in a new issue