提交 ffd61edd 编写于 作者: J John Ferlan

tlscontext: Make sure to get proper pointer to 'dname'

Keep Coverity happy by passing a pointer to 'dname' rather than the
array itself.  The PROBE expansion would cause a BAD_SIZEOF.
上级 90873ab9
/* /*
* virnettlscontext.c: TLS encryption/x509 handling * virnettlscontext.c: TLS encryption/x509 handling
* *
* Copyright (C) 2010-2012 Red Hat, Inc. * Copyright (C) 2010-2013 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -949,6 +949,7 @@ static int virNetTLSContextValidCertificate(virNetTLSContextPtr ctxt, ...@@ -949,6 +949,7 @@ static int virNetTLSContextValidCertificate(virNetTLSContextPtr ctxt,
const gnutls_datum_t *certs; const gnutls_datum_t *certs;
unsigned int nCerts, i; unsigned int nCerts, i;
char dname[256]; char dname[256];
char *dnameptr = dname;
size_t dnamesize = sizeof(dname); size_t dnamesize = sizeof(dname);
memset(dname, 0, dnamesize); memset(dname, 0, dnamesize);
...@@ -1062,14 +1063,14 @@ static int virNetTLSContextValidCertificate(virNetTLSContextPtr ctxt, ...@@ -1062,14 +1063,14 @@ static int virNetTLSContextValidCertificate(virNetTLSContextPtr ctxt,
PROBE(RPC_TLS_CONTEXT_SESSION_ALLOW, PROBE(RPC_TLS_CONTEXT_SESSION_ALLOW,
"ctxt=%p sess=%p dname=%s", "ctxt=%p sess=%p dname=%s",
ctxt, sess, dname); ctxt, sess, dnameptr);
return 0; return 0;
authdeny: authdeny:
PROBE(RPC_TLS_CONTEXT_SESSION_DENY, PROBE(RPC_TLS_CONTEXT_SESSION_DENY,
"ctxt=%p sess=%p dname=%s", "ctxt=%p sess=%p dname=%s",
ctxt, sess, dname); ctxt, sess, dnameptr);
return -1; return -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册