提交 2232e262 编写于 作者: D Dr. Stephen Henson

Fix memory leak in s2i_ASN_INTEGER and return an error
if any invalid characters are present.
上级 137e7e3a
...@@ -156,11 +156,11 @@ ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *method, char *value) ...@@ -156,11 +156,11 @@ ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *method, char *value)
ASN1_INTEGER *aint; ASN1_INTEGER *aint;
int isneg, ishex; int isneg, ishex;
int ret; int ret;
bn = BN_new();
if (!value) { if (!value) {
X509V3err(X509V3_F_S2I_ASN1_INTEGER,X509V3_R_INVALID_NULL_VALUE); X509V3err(X509V3_F_S2I_ASN1_INTEGER,X509V3_R_INVALID_NULL_VALUE);
return 0; return 0;
} }
bn = BN_new();
if (value[0] == '-') { if (value[0] == '-') {
value++; value++;
isneg = 1; isneg = 1;
...@@ -174,7 +174,8 @@ ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *method, char *value) ...@@ -174,7 +174,8 @@ ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *method, char *value)
if (ishex) ret = BN_hex2bn(&bn, value); if (ishex) ret = BN_hex2bn(&bn, value);
else ret = BN_dec2bn(&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); X509V3err(X509V3_F_S2I_ASN1_INTEGER,X509V3_R_BN_DEC2BN_ERROR);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册