Handle empty X509_NAME in printing routines.
authorDr. Stephen Henson <steve@openssl.org>
Tue, 26 Jun 2001 12:04:35 +0000 (12:04 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Tue, 26 Jun 2001 12:04:35 +0000 (12:04 +0000)
CHANGES
crypto/asn1/t_x509.c
crypto/x509/x509_obj.c

diff --git a/CHANGES b/CHANGES
index c0390345baeee5e8dc1142151170c8eeb1891ebf..74189b35c2a05c38733f28f5c9a19794a4ce44a6 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -11,6 +11,9 @@
          *) applies to 0.9.6a (/0.9.6b) and 0.9.7
          +) applies to 0.9.7 only
 
+  *) Handle special case when X509_NAME is empty in X509 printing routines.
+     [Steve Henson]
+
   *) In dsa_do_verify (crypto/dsa/dsa_ossl.c), verify that r and s are
      positive and less than q.
      [Bodo Moeller]
index 0bba0861d162f7d2a2334891ad9968e701f44afe..ff4a991b66df6cb4ea511fa5dab7c3ea0f82e8df 100644 (file)
@@ -176,7 +176,7 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
        if(!(cflag & X509_FLAG_NO_ISSUER))
                {
                if (BIO_printf(bp,"        Issuer:%c",mlch) <= 0) goto err;
-               if (!X509_NAME_print_ex(bp,X509_get_issuer_name(x),nmindent, nmflags)) goto err;
+               if (X509_NAME_print_ex(bp,X509_get_issuer_name(x),nmindent, nmflags) < 0) goto err;
                if (BIO_write(bp,"\n",1) <= 0) goto err;
                }
        if(!(cflag & X509_FLAG_NO_VALIDITY))
@@ -191,7 +191,7 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
        if(!(cflag & X509_FLAG_NO_SUBJECT))
                {
                if (BIO_printf(bp,"        Subject:%c",mlch) <= 0) goto err;
-               if (!X509_NAME_print_ex(bp,X509_get_subject_name(x),nmindent, nmflags)) goto err;
+               if (X509_NAME_print_ex(bp,X509_get_subject_name(x),nmindent, nmflags) < 0) goto err;
                if (BIO_write(bp,"\n",1) <= 0) goto err;
                }
        if(!(cflag & X509_FLAG_NO_PUBKEY))
index 6a3ba8eb154322c11965af2ac8af49c4f91d9675..f0271fdfa148d3d3ba25741ba262512bb59d53a3 100644 (file)
@@ -214,6 +214,8 @@ int i;
                }
        else
                p=buf;
+       if (i == 0)
+               *p = '\0';
        return(p);
 err:
        X509err(X509_F_X509_NAME_ONELINE,ERR_R_MALLOC_FAILURE);