Fix a bug in the new i2d_{ENUMERATED,INTEGER} that
[openssl.git] / crypto / asn1 / a_enum.c
index 34b1a38c495d623b9c5d94f5a85bddb13b6e02fe..53b30f2b56d659a60ed700ab2ad90c2b6a0bf0d1 100644 (file)
@@ -75,6 +75,7 @@ void ASN1_ENUMERATED_free(ASN1_ENUMERATED *x)
 int i2d_ASN1_ENUMERATED(ASN1_ENUMERATED *a, unsigned char **pp)
 {
        int len, ret;
+       if(!a) return 0;
        len = i2c_ASN1_INTEGER(a, NULL);        
        ret=ASN1_object_size(0,len,V_ASN1_ENUMERATED);
        if(pp) {