1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[buf] Ensure section name do not overflow buffer

IFF section name will become 127+ symbols length,
overflow of buffer is possible. Ensure buffer is
always zero-terminated and no overrun occured.
This commit is contained in:
Tsarevich Dmitry 2020-02-23 21:19:03 +03:00
parent e892c58334
commit 802f7d7523
No known key found for this signature in database
GPG key ID: E3C61298FF5B1274

View file

@ -563,8 +563,11 @@ void SetSectionHeaders(HWND hDlg)
memset(wtmp, 0, sizeof(wtmp));
GetWindowTextW(hCtrl, wtmp, ARRAYSIZE(wtmp));
wlen = wcslen(wtmp);
wtmp[wlen++] = L' ';
wtmp[wlen++] = L' ';
if (wlen < ARRAYSIZE(wtmp) - 1)
wtmp[wlen++] = L' ';
if (wlen < ARRAYSIZE(wtmp) - 1)
wtmp[wlen++] = L' ';
wtmp[ARRAYSIZE(wtmp) - 1] = L'\0';
SetWindowTextW(hCtrl, wtmp);
GetWindowRect(hCtrl, &rc);
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);