summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2018-11-09 20:07:24 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2018-11-09 20:30:11 +0100
commit59497c0e3550f65956809962ab9e6c5c723abeeb (patch)
tree99c01eb0c00fb32f0d37139dfbc3ed2738a2ff21
parentf0910a43d4ac576574a4efc4cc7c331d3f281203 (diff)
downloadgnutls-59497c0e3550f65956809962ab9e6c5c723abeeb.tar.gz
Initialize output var to avoid false negative from static analyzers
This was identified by clang analyzer's on _gnutls_x509_dn_to_string and _gnutls_x509_decode_string. Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
-rw-r--r--lib/x509/common.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/x509/common.c b/lib/x509/common.c
index b0ee8b80cc..060c2aede1 100644
--- a/lib/x509/common.c
+++ b/lib/x509/common.c
@@ -441,7 +441,7 @@ _gnutls_x509_dn_to_string(const char *oid, void *value,
{
const struct oid_to_string *oentry;
int ret;
- gnutls_datum_t tmp;
+ gnutls_datum_t tmp = {NULL, 0};
if (value == NULL || value_size <= 0) {
gnutls_assert();
@@ -633,6 +633,9 @@ _gnutls_x509_decode_string(unsigned int etype,
unsigned int str_size, len;
gnutls_datum_t td;
+ output->data = NULL;
+ output->size = 0;
+
if (allow_ber)
ret =
asn1_decode_simple_ber(etype, der, der_size, &str, &str_size, NULL);