]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
do not allow null character in DN.
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Sun, 26 Jul 2009 12:21:13 +0000 (15:21 +0300)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Sun, 26 Jul 2009 12:21:13 +0000 (15:21 +0300)
lib/x509/common.c

index c8ea6958be42962f0b2e5906e144c729330762f5..bb265a8675868dea69c365fdc21e46e5d6b8e32c 100644 (file)
@@ -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;
 }