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

Uri Lublin uril at redhat.com
Mon Sep 2 08:23:26 UTC 2019


On 9/1/19 7:20 PM, Frediano Ziglio wrote:
>>
>> 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.
>>
> 
> Why this last sentence?

oops, the first patch I wrote (and did not send) also
checked name before (switched the order of the two check lines).
Since it does not really matter, I removed it.

I'll delete this from the commit log.

Thanks,
     Uri.

> 
>> 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);
> 
> Otherwise patch is fine.
> 
> Frediano
> 



More information about the Spice-devel mailing list