In CBPaintText use the text size as returned by LB_GETTEXT. The size

returned by LB_GETTEXTLEN may be too large.
This commit is contained in:
Rein Klazes 2002-01-15 20:27:12 +00:00 committed by Alexandre Julliard
parent f57112a9f8
commit 93ece68077
1 changed files with 2 additions and 1 deletions

View File

@ -747,7 +747,8 @@ static void CBPaintText(
size = SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, id, 0);
if( (pText = HeapAlloc( GetProcessHeap(), 0, (size + 1) * sizeof(WCHAR))) )
{
SendMessageW(lphc->hWndLBox, LB_GETTEXT, (WPARAM)id, (LPARAM)pText);
/* size from LB_GETTEXTLEN may be too large, from LB_GETTEXT is accurate */
size=SendMessageW(lphc->hWndLBox, LB_GETTEXT, (WPARAM)id, (LPARAM)pText);
pText[size] = '\0'; /* just in case */
} else return;
}