summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2014-12-05 10:37:25 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2014-12-05 10:37:25 +0100
commitfb487e479b34de9eb993d8b5b2eeb222af3fd7d4 (patch)
treee86d2996e93e8cc4cb6029c86b691b358ef51fe1
parenta4f43d1405e627ad5737a9da277632e0c5326af8 (diff)
downloadgnutls-fb487e479b34de9eb993d8b5b2eeb222af3fd7d4.tar.gz
_gnutls_x509_get_dn() always return a null terminated string
-rw-r--r--lib/x509/dn.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/x509/dn.c b/lib/x509/dn.c
index f16b440a8e..f8d50876bc 100644
--- a/lib/x509/dn.c
+++ b/lib/x509/dn.c
@@ -197,9 +197,13 @@ _gnutls_x509_get_dn(ASN1_TYPE asn1_struct,
}
while (1);
+ DATA_APPEND("\x00", 1);
result = _gnutls_buffer_to_datum(&out_str, dn);
if (result < 0)
gnutls_assert();
+ if (dn->size > 0) {
+ dn->size--;
+ }
goto cleanup1;