From ad079d6cbbe8f3d67cc07490a4523d7ba7f5bb02 Mon Sep 17 00:00:00 2001
From: Duane Clark <dclark@akamail.com>
Date: Thu, 28 Feb 2002 21:42:25 +0000
Subject: [PATCH] Ask for correct number of chars in EditLblWndProcT.

---
 dlls/comctl32/listview.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index d829a8dba83..485df24a27c 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -9830,14 +9830,14 @@ static LRESULT EditLblWndProcT(HWND hwnd, UINT uMsg,
         
 	if (!cancel)
 	{
-	    DWORD len = 1 + isW ? GetWindowTextLengthW(hwnd) : GetWindowTextLengthA(hwnd);
+	    DWORD len = isW ? GetWindowTextLengthW(hwnd) : GetWindowTextLengthA(hwnd);
 
 	    if (len)
 	    {
 		if ( (buffer = COMCTL32_Alloc((len+1) * (isW ? sizeof(WCHAR) : sizeof(CHAR)))) )
 		{
-		    if (isW) GetWindowTextW(hwnd, buffer, len);
-		    else GetWindowTextA(hwnd, (CHAR*)buffer, len);
+		    if (isW) GetWindowTextW(hwnd, buffer, len+1);
+		    else GetWindowTextA(hwnd, (CHAR*)buffer, len+1);
 		}
 	    }
 	}
-- 
GitLab