comctl32/header: Check Null before accessing struct member.

This commit is contained in:
Paul Vriens 2006-06-02 10:38:22 +02:00 committed by Alexandre Julliard
parent f21983cf11
commit ddf0049e9c
1 changed files with 3 additions and 1 deletions

View File

@ -1141,15 +1141,17 @@ HEADER_GetItemT (HWND hwnd, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
{ {
HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
HEADER_ITEM *lpItem; HEADER_ITEM *lpItem;
UINT mask = phdi->mask; UINT mask;
if (!phdi) if (!phdi)
return FALSE; return FALSE;
TRACE("[nItem=%d]\n", nItem); TRACE("[nItem=%d]\n", nItem);
mask = phdi->mask;
if (mask == 0) if (mask == 0)
return TRUE; return TRUE;
if ((nItem < 0) || (nItem >= (INT)infoPtr->uNumItem)) if ((nItem < 0) || (nItem >= (INT)infoPtr->uNumItem))
return FALSE; return FALSE;