summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2009-07-26 15:21:13 +0300
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2009-07-26 15:24:24 +0300
commitcae365abb5988a20d222aa0e51e276e3498f8ef1 (patch)
tree4f172ab95fa96817fd5d2e0b0d5b4746d5052c01
parent59142cdd2dc49b386544417134c10d0678498aab (diff)
downloadgnutls_2_6_x.tar.gz
do not allow null character in DN.gnutls_2_6_x
-rw-r--r--lib/x509/common.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/x509/common.c b/lib/x509/common.c
index 9396b70e13..3eb899125d 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[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;
}