Fix a bug in the new i2d_{ENUMERATED,INTEGER} that
authorDr. Stephen Henson <steve@openssl.org>
Thu, 27 Jul 2000 01:27:22 +0000 (01:27 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Thu, 27 Jul 2000 01:27:22 +0000 (01:27 +0000)
didn't recognise NULL to mean 'don't output anything'

crypto/asn1/a_enum.c
crypto/asn1/a_int.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) {
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;
+       if(!a) return 0;
        len = i2c_ASN1_INTEGER(a, NULL);        
        ret=ASN1_object_size(0,len,V_ASN1_INTEGER);
        if(pp) {