From b030836b408700f45555ee252e6a5fcaeb386e46 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Thu, 1 Feb 2018 11:08:14 +0100 Subject: [PATCH] [WIN32K:NTUSER] Safely handle allocation failure in IntCloneMenu. CORE-14222 --- win32ss/user/ntuser/menu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/win32ss/user/ntuser/menu.c b/win32ss/user/ntuser/menu.c index 46382e48159..888b4ea696e 100644 --- a/win32ss/user/ntuser/menu.c +++ b/win32ss/user/ntuser/menu.c @@ -815,6 +815,7 @@ IntCloneMenuItems(PMENU Destination, PMENU Source) NewMenuItem->Xlpstr = NewMenuItem->lpstr.Buffer; } NewMenuItem->hbmp = MenuItem->hbmp; + Destination->cItems = i + 1; } return TRUE; } @@ -847,7 +848,7 @@ IntCloneMenu(PMENU Source) Menu->spwndNotify = NULL; Menu->cyMenu = 0; Menu->cxMenu = 0; - Menu->cItems = Source->cItems; + Menu->cItems = 0; Menu->iTop = 0; Menu->iMaxTop = 0; Menu->cxTextAlign = 0;