diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2001-01-19 14:21:48 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2001-01-19 14:21:48 +0000 |
commit | 8e8972bb680c7f91b9f615dc0fee3b1eb2cbed57 (patch) | |
tree | 96ac394f7e28b1de2e2eefd0121bd1f412323d1f /crypto/asn1/a_int.c | |
parent | 57108f0ad573347af91681568dc790f606fd0a5b (diff) |
Fixes to various ASN1_INTEGER routines for negative case.
Enhance s2i_ASN1_INTEGER().
Diffstat (limited to 'crypto/asn1/a_int.c')
-rw-r--r-- | crypto/asn1/a_int.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/crypto/asn1/a_int.c b/crypto/asn1/a_int.c index b0fc97ea27..496704b9a5 100644 --- a/crypto/asn1/a_int.c +++ b/crypto/asn1/a_int.c @@ -399,6 +399,12 @@ ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai) len=((j == 0)?0:((j/8)+1)); ret->data=(unsigned char *)OPENSSL_malloc(len+4); ret->length=BN_bn2bin(bn,ret->data); + /* Correct zero case */ + if(!ret->length) + { + ret->data[0] = 0; + ret->length = 1; + } return(ret); err: if (ret != ai) M_ASN1_INTEGER_free(ret); |