From da52d9d5d0358eaf5ae5fec5acfda81c848359b0 Mon Sep 17 00:00:00 2001 From: Mikhail Efremov Date: Thu, 2 Jun 2022 18:50:24 +0300 Subject: [PATCH] Fix build tests with gcc12 Avoid build failure with -Werror=analyzer-use-of-uninitialized-value. --- tests/Test_simple.c | 2 +- tests/Test_tree.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/Test_simple.c b/tests/Test_simple.c index 6cd07e0..42ad133 100644 --- a/tests/Test_simple.c +++ b/tests/Test_simple.c @@ -90,7 +90,7 @@ main (int argc, char *argv[]) { unsigned int etype = 38; unsigned int my_str_len = 10; - unsigned char my_str[10]; + unsigned char my_str[10] = {0}; unsigned int tl_len = 10; unsigned char tl[10]; diff --git a/tests/Test_tree.c b/tests/Test_tree.c index 5d7ad03..ea2d34a 100644 --- a/tests/Test_tree.c +++ b/tests/Test_tree.c @@ -466,11 +466,11 @@ main (int argc, char *argv[]) char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE]; FILE *out; test_type *test; - int errorCounter = 0, testCounter = 0, der_len; - unsigned char value[1024], der[1024]; - int valueLen, tag = 0, class = 0; + int errorCounter = 0, testCounter = 0, der_len = 0; + unsigned char value[1024] = {0}, der[1024] = {0}; + int valueLen = 0, tag = 0, class = 0; int k; - int start, end, verbose = 0; + int start = 0, end = 0, verbose = 0; const char *str_p = NULL; const char *treefile = getenv ("ASN1TREE"); -- 2.33.4