From e80000e6ab33f2a863d494fc6721ae78a6608175 Mon Sep 17 00:00:00 2001 From: Paul Vriens Date: Tue, 7 Nov 2006 21:29:46 +0100 Subject: [PATCH] comctl32: Fix return values of string functions. --- dlls/comctl32/string.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dlls/comctl32/string.c b/dlls/comctl32/string.c index e083ea682fc..1c01b086f99 100644 --- a/dlls/comctl32/string.c +++ b/dlls/comctl32/string.c @@ -165,8 +165,8 @@ INT WINAPI Str_GetPtrA (LPCSTR lpSrc, LPSTR lpDest, INT nMaxLen) TRACE("(%p %p %d)\n", lpSrc, lpDest, nMaxLen); - if (!lpDest && lpSrc) - return strlen (lpSrc); + if ((!lpDest || nMaxLen == 0) && lpSrc) + return (strlen(lpSrc) + 1); if (nMaxLen == 0) return 0; @@ -176,12 +176,12 @@ INT WINAPI Str_GetPtrA (LPCSTR lpSrc, LPSTR lpDest, INT nMaxLen) return 0; } - len = strlen (lpSrc); + len = strlen(lpSrc) + 1; if (len >= nMaxLen) - len = nMaxLen - 1; + len = nMaxLen; - RtlMoveMemory (lpDest, lpSrc, len); - lpDest[len] = '\0'; + RtlMoveMemory (lpDest, lpSrc, len - 1); + lpDest[len - 1] = '\0'; return len; } -- 2.11.4.GIT