Skip to content

Commit 4cffcba

Browse files
committed
Add missing error check on BN_CTX_new()
If this fails, then the big numbers will be allocated outside of the context, leading to leaks. Closes phpGH-21061.
1 parent f9519cc commit 4cffcba

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ext/openssl/openssl.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4423,6 +4423,9 @@ static bool php_openssl_pkey_init_legacy_ec(EC_KEY *eckey, zval *data, bool *is_
44234423
EC_POINT *point_q = NULL;
44244424
EC_GROUP *group = NULL;
44254425
BN_CTX *bctx = BN_CTX_new();
4426+
if (!bctx) {
4427+
goto clean_exit;
4428+
}
44264429

44274430
*is_private = false;
44284431

0 commit comments

Comments
 (0)