From: Nikos Mavrogiannopoulos Date: Sun, 26 Jul 2009 12:21:13 +0000 (+0300) Subject: do not allow null character in DN. X-Git-Tag: gnutls_2_9_2~47^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c77655eabbcd17e0e02a85727b902e157dc04fb4;p=thirdparty%2Fgnutls.git do not allow null character in DN. --- diff --git a/lib/x509/common.c b/lib/x509/common.c index c8ea6958be..bb265a8675 100644 --- a/lib/x509/common.c +++ b/lib/x509/common.c @@ -181,7 +181,7 @@ _gnutls_x509_oid_data2string (const char *oid, void *value, { char str[MAX_STRING_LEN], tmpname[128]; const char *ANAME = NULL; - int CHOICE = -1, len = -1, result; + int CHOICE = -1, len = -1, result, i; ASN1_TYPE tmpasn = ASN1_TYPE_EMPTY; char asn1_err[ASN1_MAX_ERROR_DESCRIPTION_SIZE] = ""; @@ -309,6 +309,12 @@ _gnutls_x509_oid_data2string (const char *oid, void *value, } } } + + /* Convert null char in the name to '?' + * to protect applications */ + for (i=0;i<*res_size;i++) { + if (res[i] == 0) res[i]='?'; + } return 0; }