Handle empty case in X509_NAME canonical encoding.
authorDr. Stephen Henson <steve@openssl.org>
Fri, 14 Sep 2007 18:11:17 +0000 (18:11 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Fri, 14 Sep 2007 18:11:17 +0000 (18:11 +0000)
crypto/asn1/x_name.c

index 50d3c75..193f6d4 100644 (file)
@@ -320,6 +320,12 @@ static int x509_name_canon(X509_NAME *a)
                OPENSSL_free(a->canon_enc);
                a->canon_enc = NULL;
                }
+       /* Special case: empty X509_NAME => null encoding */
+       if (sk_X509_NAME_ENTRY_num(a->entries) == 0)
+               {
+               a->canon_enclen = 0;
+               return 1;
+               }
        intname = sk_new_null();
        if(!intname)
                goto err;