]> xenbits.xensource.com Git - libvirt.git/commit
virnettlscontext: Resolve Coverity warnings (UNINIT)
authorJohn Ferlan <jferlan@redhat.com>
Fri, 9 Aug 2013 11:06:34 +0000 (07:06 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Fri, 9 Aug 2013 11:28:14 +0000 (07:28 -0400)
commitf905cc998449c89339d0e2894a71d9a9e45293e5
tree8857a0bb7e78e6ea7960eb32f9543256872a490c
parent6ff0cffd55dae2fa07e6e8dc844312a87946678c
virnettlscontext: Resolve Coverity warnings (UNINIT)

Coverity complained about the usage of the uninitialized cacerts in the
event(s) that "access(certFile, R_OK)" and/or "access(cacertFile, R_OK)"
fail the for loop used to fill in the certs will have indeterminate data
as well as the possibility that both failures would result in the
gnutls_x509_crt_deinit() call having a similar fate.

Initializing cacerts only would resolve the issue; however, it still
would leave the indeterminate action, so rather add a parameter to
the virNetTLSContextLoadCACertListFromFile() to pass the max size rather
then overloading the returned count parameter. If the the call is never
made, then we won't go through the for loops referencing the empty
cacerts
src/rpc/virnettlscontext.c