From b2e902b84063ba1aa0c6cad3079a438097b596fd Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Tue, 26 Jan 2016 09:30:02 +0000 Subject: [PATCH] bcrypt/tests: Fix incorrect null termination. Signed-off-by: Huw Davies Signed-off-by: Hans Leidekker Signed-off-by: Alexandre Julliard --- 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 edf478cfdb0..5435d4b17b2 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)