[Spice-devel] [spice-common patch] test-ssl-verify: test_generic: initialize num_entries

Uri Lublin uril at redhat.com
Sun Sep 1 13:50:12 UTC 2019


If name is null num_entries may hold garbage value

clang warning: Assigned value is garbage or undefined
   g_assert_cmpint(num_entries, ==, entry_count);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Also check name before num_entries.

Signed-off-by: Uri Lublin <uril at redhat.com>
---
 tests/test-ssl-verify.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/test-ssl-verify.c b/tests/test-ssl-verify.c
index f5c5881..f80eb4c 100644
--- a/tests/test-ssl-verify.c
+++ b/tests/test-ssl-verify.c
@@ -79,7 +79,7 @@ static void test_generic(const void *arg)
 {
     const TestGenericParams *params = arg;
     X509_NAME *name;
-    int num_entries;
+    int num_entries = -1;
 
     setup_results(params->output);
     name = subject_to_x509_name(params->input, &num_entries);
-- 
2.21.0



More information about the Spice-devel mailing list