]> xenbits.xensource.com Git - libvirt.git/commitdiff
rpc: avoid uninitialized memory use
authorEric Blake <eblake@redhat.com>
Tue, 2 Aug 2011 15:56:10 +0000 (09:56 -0600)
committerEric Blake <eblake@redhat.com>
Tue, 2 Aug 2011 17:57:06 +0000 (11:57 -0600)
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

index 2a58ede1311f29bb281e70eab6e94b063749b829..be082074cb0c62ef4c199b82e81566e740aebdb5 100644 (file)
@@ -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;