From 21777c59c7089b5240c016a5778bbec87334da80 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sun, 22 Nov 1998 15:41:00 +0000 Subject: [PATCH] CB_GETTEXT: Use lpBuffer instead of lpText for LB_GETTEXT32, handle 0 byte NULL buffer. --- controls/combo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/controls/combo.c b/controls/combo.c index 70c78990f84..fc5aade87e7 100644 --- a/controls/combo.c +++ b/controls/combo.c @@ -1001,14 +1001,16 @@ static LRESULT COMBO_GetText( LPHEADCOMBO lphc, UINT32 N, LPSTR lpText) if( lpBuffer ) { INT32 n = SendMessage32A( lphc->hWndLBox, LB_GETTEXT32, - (WPARAM32)idx, (LPARAM)lpText ); + (WPARAM32)idx, (LPARAM)lpBuffer ); /* truncate if buffer is too short */ if( length >= N ) { + if (N && lpText) { if( n != LB_ERR ) memcpy( lpText, lpBuffer, (N>n) ? n+1 : N-1 ); lpText[N - 1] = '\0'; + } HeapFree( GetProcessHeap(), 0, lpBuffer ); } return (LRESULT)n;