提交 8abeefec 编写于 作者: B Benjamin Kaduk

Fix memory leak in DH_get_nid()

If q is non-NULL but p is indeed a safe prime, a modified copy
of p could be leaked.
Reviewed-by: NRich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4525)
上级 141e4709
......@@ -66,10 +66,9 @@ int DH_get_nid(const DH *dh)
BIGNUM *q = BN_dup(dh->p);
/* Check q = p * 2 + 1 we already know q is odd, so just shift right */
if (q == NULL || !BN_rshift1(q, q) || !BN_cmp(dh->q, q)) {
BN_free(q);
return NID_undef;
}
if (q == NULL || !BN_rshift1(q, q) || !BN_cmp(dh->q, q))
nid = NID_undef;
BN_free(q);
}
return nid;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册