[WIN32K:NTUSER] Avoid allocating an extra item in IntCloneMenuItems. CORE-14222
authorThomas Faber <thomas.faber@reactos.org>
Thu, 1 Feb 2018 10:07:39 +0000 (11:07 +0100)
committerThomas Faber <thomas.faber@reactos.org>
Sun, 18 Feb 2018 10:27:32 +0000 (11:27 +0100)
win32ss/user/ntuser/menu.c

index 5ecffbb..46382e4 100644 (file)
@@ -778,10 +778,10 @@ IntCloneMenuItems(PMENU Destination, PMENU Source)
    if(!Source->cItems)
       return FALSE;
 
-   NewMenuItem = DesktopHeapAlloc(Destination->head.rpdesk, (Source->cItems+1) * sizeof(ITEM));
+   NewMenuItem = DesktopHeapAlloc(Destination->head.rpdesk, Source->cItems * sizeof(ITEM));
    if(!NewMenuItem) return FALSE;
 
-   RtlZeroMemory(NewMenuItem, (Source->cItems+1) * sizeof(ITEM));
+   RtlZeroMemory(NewMenuItem, Source->cItems * sizeof(ITEM));
 
    Destination->rgItems = NewMenuItem;