diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2002-11-13 03:40:51 +0300 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2002-11-13 03:40:51 +0300 |
commit | 2232e262bffb9330946760fe3635e6531b909df2 (patch) | |
tree | ff0d4b7907453d39a2c9c7a23e07a8c3ce1e8635 /crypto | |
parent | 137e7e3aa1e83af7c5194542e23aba38b3106548 (diff) |
Fix memory leak in s2i_ASN_INTEGER and return an error
if any invalid characters are present.
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/x509v3/v3_utl.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/x509v3/v3_utl.c b/crypto/x509v3/v3_utl.c index 283e943e46..1f0db94776 100644 --- a/crypto/x509v3/v3_utl.c +++ b/crypto/x509v3/v3_utl.c @@ -156,11 +156,11 @@ ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *method, char *value) ASN1_INTEGER *aint; int isneg, ishex; int ret; - bn = BN_new(); if (!value) { X509V3err(X509V3_F_S2I_ASN1_INTEGER,X509V3_R_INVALID_NULL_VALUE); return 0; } + bn = BN_new(); if (value[0] == '-') { value++; isneg = 1; @@ -174,7 +174,8 @@ ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *method, char *value) if (ishex) ret = BN_hex2bn(&bn, value); else ret = BN_dec2bn(&bn, value); - if (!ret) { + if (!ret || value[ret]) { + BN_free(bn); X509V3err(X509V3_F_S2I_ASN1_INTEGER,X509V3_R_BN_DEC2BN_ERROR); return 0; } |