Fix bug in copy_email() which would not
authorDr. Stephen Henson <steve@openssl.org>
Thu, 1 Mar 2001 13:33:53 +0000 (13:33 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Thu, 1 Mar 2001 13:33:53 +0000 (13:33 +0000)
find emailAddress at start of subject name.

CHANGES
crypto/x509v3/v3_alt.c

diff --git a/CHANGES b/CHANGES
index 7707467d34c3c7c94981b5558cac5e21c718e81c..82a02295a4fb4ab979d0cf58e3927505289ed598 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,10 @@
 
  Changes between 0.9.6 and 0.9.6a  [xx XXX 2001]
 
+  *) In copy_email() check for >= 0 as a return value for
+     X509_NAME_get_index_by_NID() since 0 is a valid index.
+     [Steve Henson reported by Massimiliano Pala <madwolf@opensca.org>]
+
   *) Use better test patterns in bntest.
      [Ulf Möller]
 
index 733919f2507b4a044f851875556ef04f10dcc6f3..94bebcd4480c835259683b0973ed8601a0b2286b 100644 (file)
@@ -270,7 +270,7 @@ static int copy_email(X509V3_CTX *ctx, STACK_OF(GENERAL_NAME) *gens)
        /* Now add any email address(es) to STACK */
        i = -1;
        while((i = X509_NAME_get_index_by_NID(nm,
-                                        NID_pkcs9_emailAddress, i)) > 0) {
+                                        NID_pkcs9_emailAddress, i)) >= 0) {
                ne = X509_NAME_get_entry(nm, i);
                email = M_ASN1_IA5STRING_dup(X509_NAME_ENTRY_get_data(ne));
                if(!email || !(gen = GENERAL_NAME_new())) {