Add some argument validation to SetMenuItemInfoA, so QT5 does not

corrupt its menus.
This commit is contained in:
Marcus Meissner 2001-07-08 20:31:41 +00:00 committed by Alexandre Julliard
parent 2420fa983d
commit 05aeaf1568
1 changed files with 9 additions and 0 deletions

View File

@ -4479,6 +4479,15 @@ static BOOL SetMenuItemInfo_common(MENUITEM * menu,
BOOL WINAPI SetMenuItemInfoA(HMENU hmenu, UINT item, BOOL bypos, BOOL WINAPI SetMenuItemInfoA(HMENU hmenu, UINT item, BOOL bypos,
const MENUITEMINFOA *lpmii) const MENUITEMINFOA *lpmii)
{ {
if ((lpmii->fType & (MF_HILITE|MF_POPUP)) || (lpmii->fState)) {
/* QuickTime does pass invalid data into SetMenuItemInfo.
* do some of the checks Windows does.
*/
WARN("Bad masks for type (0x%08x) or state (0x%08x)\n",
lpmii->fType,lpmii->fState );
return FALSE;
}
return SetMenuItemInfo_common(MENU_FindItem(&hmenu, &item, bypos? MF_BYPOSITION : 0), return SetMenuItemInfo_common(MENU_FindItem(&hmenu, &item, bypos? MF_BYPOSITION : 0),
(const MENUITEMINFOW *)lpmii, FALSE); (const MENUITEMINFOW *)lpmii, FALSE);
} }