comctl32/propsheet: Enforce minimal PROPSHEETPAGE structure size when creating a page.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2017-03-01 22:47:20 +03:00 committed by Alexandre Julliard
parent b5b26c204f
commit a3aa217f03
2 changed files with 10 additions and 4 deletions

View File

@ -2957,8 +2957,12 @@ static LPWSTR load_string( HINSTANCE instance, LPCWSTR str )
HPROPSHEETPAGE WINAPI CreatePropertySheetPageA(
LPCPROPSHEETPAGEA lpPropSheetPage)
{
PROPSHEETPAGEW* ppsp = Alloc(sizeof(PROPSHEETPAGEW));
PROPSHEETPAGEW *ppsp;
if (lpPropSheetPage->dwSize < PROPSHEETPAGEA_V1_SIZE)
return NULL;
ppsp = Alloc(sizeof(PROPSHEETPAGEW));
memcpy(ppsp,lpPropSheetPage,min(lpPropSheetPage->dwSize,sizeof(PROPSHEETPAGEA)));
ppsp->dwFlags &= ~ PSP_INTERNAL_UNICODE;
@ -3023,8 +3027,12 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageA(
*/
HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage)
{
PROPSHEETPAGEW* ppsp = Alloc(sizeof(PROPSHEETPAGEW));
PROPSHEETPAGEW *ppsp;
if (lpPropSheetPage->dwSize < PROPSHEETPAGEW_V1_SIZE)
return NULL;
ppsp = Alloc(sizeof(PROPSHEETPAGEW));
memcpy(ppsp,lpPropSheetPage,min(lpPropSheetPage->dwSize,sizeof(PROPSHEETPAGEW)));
ppsp->dwFlags |= PSP_INTERNAL_UNICODE;

View File

@ -1076,7 +1076,6 @@ static void test_CreatePropertySheetPage(void)
hpsp = CreatePropertySheetPageA(&page.u.pageA);
if (page.u.pageA.dwSize < PROPSHEETPAGEA_V1_SIZE)
todo_wine
ok(hpsp == NULL, "Expected failure, size %u\n", page.u.pageA.dwSize);
else
{
@ -1108,7 +1107,6 @@ static void test_CreatePropertySheetPage(void)
hpsp = CreatePropertySheetPageW(&page.u.pageW);
if (page.u.pageW.dwSize < PROPSHEETPAGEW_V1_SIZE)
todo_wine
ok(hpsp == NULL, "Expected failure, size %u\n", page.u.pageW.dwSize);
else
{