Piotr Caban : msvcrt: Fixed strncpy_s behavior when count equals 0.

Alexandre Julliard julliard at winehq.org
Fri Sep 7 13:26:22 CDT 2012


Module: wine
Branch: master
Commit: bdf9a9f9bd56354f70a7431a9682183b84353211
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=bdf9a9f9bd56354f70a7431a9682183b84353211

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Fri Sep  7 16:58:23 2012 +0200

msvcrt: Fixed strncpy_s behavior when count equals 0.

---

 dlls/msvcrt/heap.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/dlls/msvcrt/heap.c b/dlls/msvcrt/heap.c
index 5eaf4a1..0a0d819 100644
--- a/dlls/msvcrt/heap.c
+++ b/dlls/msvcrt/heap.c
@@ -598,8 +598,11 @@ int CDECL strncpy_s(char *dest, MSVCRT_size_t numberOfElements,
 
     TRACE("(%s %lu %s %lu)\n", dest, numberOfElements, src, count);
 
-    if(!count)
+    if(!count) {
+        if(dest && numberOfElements)
+            *dest = 0;
         return 0;
+    }
 
     if (!MSVCRT_CHECK_PMT(dest != NULL)) return MSVCRT_EINVAL;
     if (!MSVCRT_CHECK_PMT(src != NULL)) return MSVCRT_EINVAL;




More information about the wine-cvs mailing list