Commit 16fefcd6 authored by Mikołaj Zalewski's avatar Mikołaj Zalewski Committed by Alexandre Julliard

comctl32: header: Don't modify the user supplied HDITEM during Set/InsertItem.

parent e3467de9
...@@ -131,22 +131,21 @@ static void HEADER_StoreHDItemInHeader(HEADER_ITEM *lpItem, HDITEMW *phdi, BOOL ...@@ -131,22 +131,21 @@ static void HEADER_StoreHDItemInHeader(HEADER_ITEM *lpItem, HDITEMW *phdi, BOOL
if (phdi->mask & HDI_TEXT) if (phdi->mask & HDI_TEXT)
{ {
if (!phdi->pszText) phdi->pszText = emptyString; /* null pointer check */
if (phdi->pszText != LPSTR_TEXTCALLBACKW) /* covers != TEXTCALLBACKA too */ if (phdi->pszText != LPSTR_TEXTCALLBACKW) /* covers != TEXTCALLBACKA too */
{ {
LPWSTR pszText;
if (lpItem->pszText) if (lpItem->pszText)
{ {
if (lpItem->pszText != emptyString && lpItem->pszText != LPSTR_TEXTCALLBACKW) if (lpItem->pszText != emptyString && lpItem->pszText != LPSTR_TEXTCALLBACKW)
Free(lpItem->pszText); Free(lpItem->pszText);
lpItem->pszText = NULL; lpItem->pszText = NULL;
} }
if (phdi->pszText)
{ pszText = (phdi->pszText != NULL ? phdi->pszText : emptyString);
if (fUnicode) if (fUnicode)
Str_SetPtrW(&lpItem->pszText, phdi->pszText); Str_SetPtrW(&lpItem->pszText, pszText);
else else
Str_SetPtrAtoW(&lpItem->pszText, (LPSTR)phdi->pszText); Str_SetPtrAtoW(&lpItem->pszText, (LPSTR)pszText);
}
} }
else else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment