Huw Davies : bcrypt/tests: Fix incorrect null termination.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jan 26 10:32:51 CST 2016


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

Author: Huw Davies <huw at codeweavers.com>
Date:   Tue Jan 26 09:30:02 2016 +0000

bcrypt/tests: Fix incorrect null termination.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/bcrypt/tests/bcrypt.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
index edf478c..5435d4b 100644
--- a/dlls/bcrypt/tests/bcrypt.c
+++ b/dlls/bcrypt/tests/bcrypt.c
@@ -68,15 +68,15 @@ static void test_BCryptGetFipsAlgorithmMode(void)
     ok(ret == STATUS_INVALID_PARAMETER, "Expected STATUS_INVALID_PARAMETER, got 0x%x\n", ret);
 }
 
-static const char *format_hash(const UCHAR *bytes, ULONG size, char *buf)
+static void format_hash(const UCHAR *bytes, ULONG size, char *buf)
 {
     ULONG i;
+    buf[0] = '\0';
     for (i = 0; i < size; i++)
     {
-        buf += sprintf(buf, "%02x", bytes[i]);
+        sprintf(buf + i * 2, "%02x", bytes[i]);
     }
-    buf[i * 2] = 0;
-    return buf;
+    return;
 }
 
 static void test_sha1(void)




More information about the wine-cvs mailing list