From c3763fc86e9873c97134d8a2e6f935af8cdb9941 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Tue, 22 Jul 2014 11:26:28 +1000 Subject: [PATCH] 3898. [bug] To small a buffer in tohexstr() calls in test code. [RT #36598] (cherry picked from commit 6a6838f97363c7f3abe47e1fb116be2593bc53a5) --- CHANGES | 3 +++ lib/isc/tests/hash_test.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index d1495ddb60..e57a923983 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +3898. [bug] To small a buffer in tohexstr() calls in test code. + [RT #36598] + 3894. [bug] Buffers in isc_print_vsnprintf were not properly initialized leading to potential overflows when printing out quad values. [RT #36505] diff --git a/lib/isc/tests/hash_test.c b/lib/isc/tests/hash_test.c index 845480819a..bcfa63f479 100644 --- a/lib/isc/tests/hash_test.c +++ b/lib/isc/tests/hash_test.c @@ -39,7 +39,7 @@ unsigned char digest[ISC_SHA512_DIGESTLENGTH]; unsigned char buffer[1024]; const char *s; -char str[ISC_SHA512_DIGESTLENGTH]; +char str[2 * ISC_SHA512_DIGESTLENGTH + 1]; unsigned char key[20]; int i = 0; @@ -51,7 +51,7 @@ tohexstr(unsigned char *d, unsigned int len, char *out); * Postcondition: A String representation of the given hexadecimal number is * placed into the array *out * - * 'out' MUST point to an array of at least len / 2 + 1 + * 'out' MUST point to an array of at least len * 2 + 1 * * Return values: ISC_R_SUCCESS if the operation is sucessful */