[libvirt] [PATCH 2/3] rpc: avoid uninitialized memory use

Laine Stump laine at laine.org
Tue Aug 2 17:27:30 UTC 2011


On 08/02/2011 12:12 PM, Eric Blake wrote:
> Spotted by Coverity.  Gnutls documents that buffer must be NULL
> if gnutls_x509_crt_get_key_purpose_oid is to be used to determine
> the correct size needed for allocating a buffer.
>
> * src/rpc/virnettlscontext.c
> (virNetTLSContextCheckCertKeyPurpose): Initialize buffer.
> ---
>   src/rpc/virnettlscontext.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/rpc/virnettlscontext.c b/src/rpc/virnettlscontext.c
> index 2a58ede..be08207 100644
> --- a/src/rpc/virnettlscontext.c
> +++ b/src/rpc/virnettlscontext.c
> @@ -264,7 +264,7 @@ static int virNetTLSContextCheckCertKeyPurpose(gnutls_x509_crt_t cert,
>       int i;
>       unsigned int purposeCritical;
>       unsigned int critical;
> -    char *buffer;
> +    char *buffer = NULL;
>       size_t size;
>       bool allowClient = false, allowServer = false;

ACK.




More information about the libvir-list mailing list