Make i2c_ASN1_BIT_STRING return the correct length.
authorDr. Stephen Henson <steve@openssl.org>
Wed, 29 May 2002 23:14:01 +0000 (23:14 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Wed, 29 May 2002 23:14:01 +0000 (23:14 +0000)
crypto/asn1/a_bitstr.c

index c36817c..ed0bdfb 100644 (file)
@@ -71,8 +71,6 @@ int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
        if (a == NULL) return(0);
 
        len=a->length;
-       ret=1+len;
-       if (pp == NULL) return(ret);
 
        if (len > 0)
                {
@@ -100,6 +98,10 @@ int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
                }
        else
                bits=0;
+
+       ret=1+len;
+       if (pp == NULL) return(ret);
+
        p= *pp;
 
        *(p++)=(unsigned char)bits;