Make X509_NAME produce correct encoding when empty.
authorDr. Stephen Henson <steve@openssl.org>
Mon, 12 Feb 2001 03:16:13 +0000 (03:16 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Mon, 12 Feb 2001 03:16:13 +0000 (03:16 +0000)
CHANGES
crypto/asn1/x_name.c

diff --git a/CHANGES b/CHANGES
index 3030c8cf873f2be95ed42b48b9494a31965bbff4..bfcdca24902836f62503c32e682056915b5c1a57 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,10 @@
 
  Changes between 0.9.6 and 0.9.6a  [xx XXX 2001]
 
+  *) Fix X509_NAME bug which produced incorrect encoding if X509_NAME
+     was empty.
+     [Steve Henson]
+
   *) Use the cached encoding of an X509_NAME structure rather than
      copying it. This is apparently the reason for the libsafe "errors"
      but the code is actually correct.
index b832deb928b0fe48d35fd55ceb5a3f5126caabf2..585a375c4892938e91937fd08690cafcd2e4f87d 100644 (file)
@@ -141,8 +141,9 @@ static int i2d_X509_NAME_entries(X509_NAME *a)
                        }
                size+=i2d_X509_NAME_ENTRY(ne,NULL);
                }
-
-       ret+=ASN1_object_size(1,size,V_ASN1_SET);
+       /* If empty no extra SET OF needed */
+       if (ret)
+               ret+=ASN1_object_size(1,size,V_ASN1_SET);
        if (fe != NULL)
                fe->size=size;