[comctl32 1/2] Fix returnvalues
Paul Vriens
paul.vriens.wine at gmail.com
Tue Nov 7 14:29:46 CST 2006
Hi,
while going through some Coverity reports I've started some tests that
revealed these bugs.
Changelog
Fix returnvalues
Cheers,
Paul.
---
dlls/comctl32/string.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/comctl32/string.c b/dlls/comctl32/string.c
index e083ea6..1c01b08 100644
--- a/dlls/comctl32/string.c
+++ b/dlls/comctl32/string.c
@@ -165,8 +165,8 @@ INT WINAPI Str_GetPtrA (LPCSTR lpSrc, LP
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, LP
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;
}
--
1.4.3.4
More information about the wine-patches
mailing list