diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2009-07-26 15:21:13 +0300 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2009-07-26 15:24:12 +0300 |
commit | 21bc1439e5ce485dfc34ae7da425a7d4126888af (patch) | |
tree | d666717a31607d17c5cf75ab5d958e323e059bd7 /lib | |
parent | 67d45d86e1dd243e34b1c54c3500821e0d1963d3 (diff) | |
download | gnutls-21bc1439e5ce485dfc34ae7da425a7d4126888af.tar.gz |
do not allow null character in DN.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/x509/common.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/x509/common.c b/lib/x509/common.c index 2bcc66e5ef..47a569315f 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] = ""; @@ -311,6 +311,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; } |