Commit a3aa217f authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

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

parent b5b26c20
......@@ -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;
......
......@@ -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
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment