Reinstate the check for invalid length BIT STRINGS,
[openssl.git] / crypto / asn1 / a_bitstr.c
index ed0bdfbde1a75ba478863bde12d351b4877ce6c7..e0265f69d2a5aea15089792a74e5ccd7c2dc8126 100644 (file)
@@ -120,6 +120,12 @@ ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, unsigned char **pp,
        unsigned char *p,*s;
        int i;
 
+       if (len < 1)
+               {
+               i=ASN1_R_STRING_TOO_SHORT;
+               goto err;
+               }
+
        if ((a == NULL) || ((*a) == NULL))
                {
                if ((ret=M_ASN1_BIT_STRING_new()) == NULL) return(NULL);