Encode INTEGER correctly.
authorDr. Stephen Henson <steve@openssl.org>
Mon, 18 Mar 2013 14:19:40 +0000 (14:19 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Mon, 18 Mar 2013 14:22:08 +0000 (14:22 +0000)
If an ASN1_INTEGER structure is allocated but not explicitly set encode
it as zero: don't generate an invalid zero length INTEGER.
(cherry picked from commit 1643edc63c3e15b6db5a15a728bc288f2cc2bbc7)

crypto/asn1/a_int.c

index ad0d2506f63203679814cd36018f1dc9c4221b91..297c45a9ff12ebb54df717bd7c1f8487579daad4 100644 (file)
@@ -116,7 +116,7 @@ int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp)
        int pad=0,ret,i,neg;
        unsigned char *p,*n,pb=0;
 
-       if ((a == NULL) || (a->data == NULL)) return(0);
+       if (a == NULL) return(0);
        neg=a->type & V_ASN1_NEG;
        if (a->length == 0)
                ret=1;