Fix a bug in the new i2d_{ENUMERATED,INTEGER} that
[openssl.git] / crypto / asn1 / a_int.c
index 45927ffd6e6ec81f4b6323001046c1a20285f29e..bb8e9cf8f9faf640c4a5a00320494e5f63c8c8d8 100644 (file)
@@ -77,6 +77,7 @@ int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y)
 int i2d_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp)
 {
        int len, ret;
 int i2d_ASN1_INTEGER(ASN1_INTEGER *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_INTEGER);
        if(pp) {
        len = i2c_ASN1_INTEGER(a, NULL);        
        ret=ASN1_object_size(0,len,V_ASN1_INTEGER);
        if(pp) {