]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
test/bioprinttest.c: use the whole buffer for checks
authorEugene Syromiatnikov <esyr@openssl.org>
Thu, 14 Aug 2025 07:58:01 +0000 (09:58 +0200)
committerNeil Horman <nhorman@openssl.org>
Fri, 29 Aug 2025 16:18:30 +0000 (12:18 -0400)
There is no need to decrement the size of buffer by 1, snprintf should
terminate the output with a \0.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28177)

test/bioprinttest.c

index 27dcc517ac1797fb6a813c8b1d84295ef6ef5ab7..a9dcdb02c9b4277e4f46e06827c0c8bbaf902598 100644 (file)
@@ -141,7 +141,7 @@ static int test_zu(int i)
 
     memset(bio_buf, '@', sizeof(bio_buf));
 
-    BIO_snprintf(bio_buf, sizeof(bio_buf) - 1, data->format, data->value);
+    BIO_snprintf(bio_buf, sizeof(bio_buf), data->format, data->value);
     if (!TEST_str_eq(bio_buf, data->expected))
         return 0;
     return 1;
@@ -171,7 +171,7 @@ static int test_j(int i)
 
     memset(bio_buf, '@', sizeof(bio_buf));
 
-    BIO_snprintf(bio_buf, sizeof(bio_buf) - 1, data->format, data->value);
+    BIO_snprintf(bio_buf, sizeof(bio_buf), data->format, data->value);
     if (!TEST_str_eq(bio_buf, data->expected))
         return 0;
     return 1;