Alexandre Julliard : ntdll: Fix wcsncpy() implementation now that length is unsigned.

Alexandre Julliard julliard at winehq.org
Mon Aug 3 16:35:36 CDT 2020


Module: wine
Branch: master
Commit: 647c54e539c6dcc76c6289bad0fc387274d999eb
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=647c54e539c6dcc76c6289bad0fc387274d999eb

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Aug  3 13:00:03 2020 +0200

ntdll: Fix wcsncpy() implementation now that length is unsigned.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49206
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/wcstring.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/ntdll/wcstring.c b/dlls/ntdll/wcstring.c
index 393d5af8c2..eee856b21d 100644
--- a/dlls/ntdll/wcstring.c
+++ b/dlls/ntdll/wcstring.c
@@ -244,8 +244,8 @@ int __cdecl wcsncmp( LPCWSTR str1, LPCWSTR str2, size_t n )
 LPWSTR __cdecl wcsncpy( LPWSTR s1, LPCWSTR s2, size_t n )
 {
     WCHAR *ret = s1;
-    while (n-- > 0) if (!(*s1++ = *s2++)) break;
-    while (n-- > 0) *s1++ = 0;
+    for ( ; n; n--) if (!(*s1++ = *s2++)) break;
+    for ( ; n; n--) *s1++ = 0;
     return ret;
 }
 




More information about the wine-cvs mailing list