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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> 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?

> Signed-off-by: Uri Lublin <uril@xxxxxxxxxx>
> ---
>  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
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]