Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 10 additions & 1 deletion ext/openssl/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -4256,7 +4256,12 @@ static bool php_openssl_pkey_init_legacy_dh(DH *dh, zval *data, bool *is_private
OPENSSL_PKEY_SET_BN(data, p);
OPENSSL_PKEY_SET_BN(data, q);
OPENSSL_PKEY_SET_BN(data, g);
if (!p || !g || !DH_set0_pqg(dh, p, q, g)) {
if (!p || !q) {
BN_free(p);
return 0;
}

if (!DH_set0_pqg(dh, p, q, g)) {
return 0;
}

Expand All @@ -4269,6 +4274,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
6 changes: 3 additions & 3 deletions main/php_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* edit configure.ac to change version number */
#define PHP_MAJOR_VERSION 8
#define PHP_MINOR_VERSION 4
#define PHP_RELEASE_VERSION 18
#define PHP_RELEASE_VERSION 19
#define PHP_EXTRA_VERSION "-dev"
#define PHP_VERSION "8.4.18-dev"
#define PHP_VERSION_ID 80418
#define PHP_VERSION "8.4.19-dev"
#define PHP_VERSION_ID 80419
Loading