comctl32/toolbar: Protect from NULL pointer access in TB_GETBUTTONINFOW handler.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
904c695de8
commit
26067cc0b9
|
@ -1710,12 +1710,13 @@ static void test_recalc(void)
|
||||||
static void test_getbuttoninfo(void)
|
static void test_getbuttoninfo(void)
|
||||||
{
|
{
|
||||||
HWND hToolbar = NULL;
|
HWND hToolbar = NULL;
|
||||||
|
TBBUTTONINFOW tbiW;
|
||||||
|
TBBUTTONINFOA tbi;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
rebuild_toolbar_with_buttons(&hToolbar);
|
rebuild_toolbar_with_buttons(&hToolbar);
|
||||||
for (i = 0; i < 128; i++)
|
for (i = 0; i < 128; i++)
|
||||||
{
|
{
|
||||||
TBBUTTONINFOA tbi;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
tbi.cbSize = i;
|
tbi.cbSize = i;
|
||||||
|
@ -1727,6 +1728,14 @@ static void test_getbuttoninfo(void)
|
||||||
compare(ret, -1, "%d");
|
compare(ret, -1, "%d");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TBIF_TEXT with NULL pszText */
|
||||||
|
memset(&tbiW, 0, sizeof(tbiW));
|
||||||
|
tbiW.cbSize = sizeof(tbiW);
|
||||||
|
tbiW.dwMask = TBIF_BYINDEX | TBIF_STYLE | TBIF_COMMAND | TBIF_TEXT;
|
||||||
|
i = SendMessageA(hToolbar, TB_GETBUTTONINFOW, 1, (LPARAM)&tbiW);
|
||||||
|
ok(i == 1, "Got index %d\n", i);
|
||||||
|
|
||||||
DestroyWindow(hToolbar);
|
DestroyWindow(hToolbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3397,7 +3397,7 @@ TOOLBAR_GetButtonInfoT(const TOOLBAR_INFO *infoPtr, INT Id, LPTBBUTTONINFOW lpTb
|
||||||
Str_GetPtrW(lpText, lpTbInfo->pszText, lpTbInfo->cchText);
|
Str_GetPtrW(lpText, lpTbInfo->pszText, lpTbInfo->cchText);
|
||||||
else
|
else
|
||||||
Str_GetPtrWtoA(lpText, (LPSTR)lpTbInfo->pszText, lpTbInfo->cchText);
|
Str_GetPtrWtoA(lpText, (LPSTR)lpTbInfo->pszText, lpTbInfo->cchText);
|
||||||
} else
|
} else if (!bUnicode || lpTbInfo->pszText)
|
||||||
lpTbInfo->pszText[0] = '\0';
|
lpTbInfo->pszText[0] = '\0';
|
||||||
}
|
}
|
||||||
return nIndex;
|
return nIndex;
|
||||||
|
|
Loading…
Reference in New Issue