Skip to content

Commit 9add43a

Browse files
authored
Fix unchecked BN_bin2bn() call (#22754)
1 parent 1f98ff9 commit 9add43a

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

ext/openssl/openssl_backend_v1.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,11 @@ zend_string *php_openssl_dh_compute_key(EVP_PKEY *pkey, char *pub_str, size_t pu
589589
}
590590

591591
BIGNUM *pub = BN_bin2bn((unsigned char*)pub_str, (int)pub_len, NULL);
592+
if (pub == NULL) {
593+
php_openssl_store_errors();
594+
return NULL;
595+
}
596+
592597
zend_string *data = zend_string_alloc(DH_size(dh), 0);
593598
int len = DH_compute_key((unsigned char*)ZSTR_VAL(data), pub, dh);
594599
BN_free(pub);

0 commit comments

Comments
 (0)