From b1ee0461d7e643b7ab6b721f70872668c984e4ec Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sat, 1 May 1999 10:37:00 +0000 Subject: [PATCH] Authors: Chris Morgan , James Abbatiello Fixed HEADER_InsertItemA and HEADER_InsertItemW null pointer checking to handle wide character strings properly. Fix of our previous patch for null pointer checking. --- dlls/comctl32/header.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/dlls/comctl32/header.c b/dlls/comctl32/header.c index f28b5b5cac8..5c8b92316c8 100644 --- a/dlls/comctl32/header.c +++ b/dlls/comctl32/header.c @@ -763,8 +763,11 @@ HEADER_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) if (phdi->mask & HDI_TEXT) { if (!phdi->pszText) /* null pointer check */ - phdi->pszText = ""; - if (phdi->pszText != LPSTR_TEXTCALLBACKA) { + { + lpItem->pszText = COMCTL32_Alloc(sizeof(WCHAR)); + lstrcpyAtoW(lpItem->pszText, ""); + } + else if (phdi->pszText != LPSTR_TEXTCALLBACKA) { len = lstrlenA (phdi->pszText); lpItem->pszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); lstrcpyAtoW (lpItem->pszText, phdi->pszText); @@ -849,8 +852,11 @@ HEADER_InsertItemW (HWND hwnd, WPARAM wParam, LPARAM lParam) if (phdi->mask & HDI_TEXT) { if (!phdi->pszText) /* null pointer check */ - phdi->pszText = ""; - if (phdi->pszText != LPSTR_TEXTCALLBACKW) { + { + lpItem->pszText = COMCTL32_Alloc(sizeof(WCHAR)); + lstrcpyAtoW(lpItem->pszText, ""); + } + else if (phdi->pszText != LPSTR_TEXTCALLBACKW) { len = lstrlenW (phdi->pszText); lpItem->pszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); lstrcpyW (lpItem->pszText, phdi->pszText);