From 556db9a9e9fb7993c0d88e440ba12f8be1871c75 Mon Sep 17 00:00:00 2001 From: vlo Date: Fri, 10 May 2019 08:43:25 +0200 Subject: [PATCH] Fix: buffer sizes (again) Also honor the trailing 0 byte for buffers used in sprintf --- src/modules/module_20200.c | 2 +- src/modules/module_20300.c | 2 +- src/modules/module_20400.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/module_20200.c b/src/modules/module_20200.c index 18b8c3f91..be3e4672b 100644 --- a/src/modules/module_20200.c +++ b/src/modules/module_20200.c @@ -200,7 +200,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE tmp[7] = byte_swap_64 (digest[7]); tmp[8] = 0; - char salt_enc[256] = { 0 }; + char salt_enc[257] = { 0 }; char hash_enc[128] = { 0 }; const size_t salt_len_enc = base64_encode (int_to_alternate_base64, (const u8 *) pbkdf2_sha512->salt_buf, salt->salt_len, (u8 *) salt_enc); diff --git a/src/modules/module_20300.c b/src/modules/module_20300.c index e8481bfe9..c19d1aa1f 100644 --- a/src/modules/module_20300.c +++ b/src/modules/module_20300.c @@ -199,7 +199,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE tmp[7] = byte_swap_32 (digest[7]); tmp[8] = 0; - char salt_enc[256] = { 0 }; + char salt_enc[257] = { 0 }; char hash_enc[128] = { 0 }; const size_t salt_len_enc = base64_encode (int_to_alternate_base64, (const u8 *) pbkdf2_sha256->salt_buf, salt->salt_len, (u8 *) salt_enc); diff --git a/src/modules/module_20400.c b/src/modules/module_20400.c index 7cfac4618..2bb91c24c 100644 --- a/src/modules/module_20400.c +++ b/src/modules/module_20400.c @@ -192,7 +192,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE tmp[4] = byte_swap_32 (digest[4]); tmp[5] = 0; - char salt_enc[256] = { 0 }; + char salt_enc[257] = { 0 }; char hash_enc[128] = { 0 }; const size_t salt_len_enc = base64_encode (int_to_alternate_base64, (const u8 *) pbkdf2_sha1->salt_buf, salt->salt_len, (u8 *) salt_enc);