Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ext/openssl/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -4269,6 +4269,10 @@ static bool php_openssl_pkey_init_legacy_dh(DH *dh, zval *data, bool *is_private
if (priv_key) {
pub_key = php_openssl_dh_pub_from_priv(priv_key, g, p);
if (pub_key == NULL) {
BN_free(p);
Copy link
Member

@devnexen devnexen Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks fine here; while not being an expert of openssl, what do you think of the code path from line 4259 ? e.g. should g be freed if it is not null ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it has the same conceptual issue as #21062, the big numbers haven't escaped yet
Fixed here now too

BN_free(q);
BN_free(g);
BN_free(priv_key);
return 0;
}
return DH_set0_key(dh, pub_key, priv_key);
Expand Down
Loading