提交 58f0f52e 编写于 作者: B Bodo Möller

handle the case when BN_new returns NULL

上级 55b3c877
...@@ -458,12 +458,20 @@ BIGNUM *bn_dup_expand(const BIGNUM *b, int words) ...@@ -458,12 +458,20 @@ BIGNUM *bn_dup_expand(const BIGNUM *b, int words)
if (a) if (a)
{ {
r = BN_new(); r = BN_new();
r->top = b->top; if (r)
r->dmax = words; {
r->neg = b->neg; r->top = b->top;
r->d = a; r->dmax = words;
r->neg = b->neg;
r->d = a;
}
else
{
/* r == NULL, BN_new failure */
OPENSSL_free(a);
}
} }
/* Otherwise, there was an error in allocation in /* If a == NULL, there was an error in allocation in
internal_bn_expand(), and NULL should be returned */ internal_bn_expand(), and NULL should be returned */
} }
else else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册