From: Simon Josefsson Date: Thu, 6 Aug 2009 22:24:44 +0000 (+0200) Subject: Refuse to return DNs with embedded NULs which breaks other code. X-Git-Tag: gnutls_2_9_2~31^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d84eee86739e1f9765c0439bb529a06af486467b;p=thirdparty%2Fgnutls.git Refuse to return DNs with embedded NULs which breaks other code. Problem published by Dan Kaminsky and Moxie Marlinspike at BlackHat09. --- diff --git a/lib/x509/common.c b/lib/x509/common.c index c8ea6958be..c44d720c4c 100644 --- a/lib/x509/common.c +++ b/lib/x509/common.c @@ -242,6 +242,10 @@ _gnutls_x509_oid_data2string (const char *oid, void *value, { str[len] = 0; + /* Refuse to deal with strings containing NULs. */ + if (strlen (str) != len) + return GNUTLS_E_ASN1_DER_ERROR; + if (res) _gnutls_str_cpy (res, *res_size, str); *res_size = len; @@ -295,6 +299,10 @@ _gnutls_x509_oid_data2string (const char *oid, void *value, { str[len] = 0; + /* Refuse to deal with strings containing NULs. */ + if (strlen (str) != len) + return GNUTLS_E_ASN1_DER_ERROR; + if (res) _gnutls_str_cpy (res, *res_size, str); *res_size = len;