[php-src] master: openssl: check if reneg_limit_callback is callable prior to calling
| From: | Gina Peter Banyard | Date: | Mon, 19 Oct 2026 17:19:14 +0000 |
| Subject: | [php-src] master: openssl: check if reneg_limit_callback is callable prior to calling | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-142458@lists.php.net to get a copy of this message | ||
Author: Gina Peter Banyard (Girgias)
Date: 2026-10-19T18:19:03+01:00
Commit: https://github.com/php/php-src/commit/1f29f47044bce6d271bf3bea6539efb772597a03
Raw diff: https://github.com/php/php-src/commit/1f29f47044bce6d271bf3bea6539efb772597a03.diff
openssl: check if reneg_limit_callback is callable prior to calling
Changed paths:
M ext/openssl/xp_ssl.c
Diff:
diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c
index b352706c51b8..c4dd3b14b76d 100644
--- a/ext/openssl/xp_ssl.c
+++ b/ext/openssl/xp_ssl.c
@@ -1203,23 +1203,27 @@ static void php_openssl_limit_handshake_reneg(const SSL *ssl) /* {{{ */
/* The token level exceeds our allowed limit */
if (sslsock->reneg->tokens > sslsock->reneg->limit) {
zval *val;
-
-
sslsock->reneg->should_close = 1;
if (PHP_STREAM_CONTEXT(stream) && (val =
php_stream_context_get_option(PHP_STREAM_CONTEXT(stream),
"ssl", "reneg_limit_callback")) != NULL
) {
+ zend_fcall_info_cache fcc;
+
+ if (!zend_is_callable(val, &fcc, NULL)) {
+ php_stream_warn(stream, UserspaceCallFailed, "SSL: failed invoking reneg limit
notification callback");
+ return;
+ }
zval param, retval;
php_stream_to_zval(stream, ¶m);
/* Closing the stream inside this callback would segfault! */
stream->flags |= PHP_STREAM_FLAG_NO_FCLOSE;
- if (FAILURE == call_user_function(NULL, NULL, val, &retval, 1, ¶m)) {
- php_stream_warn(stream, UserspaceCallFailed, "SSL: failed invoking reneg limit
notification callback");
- }
+ zend_call_known_fcc(&fcc, &retval, 1, ¶m, NULL);
stream->flags ^= PHP_STREAM_FLAG_NO_FCLOSE;
+ /* Release potential trampoline */
+ zend_release_fcall_info_cache(&fcc);
/* If the reneg_limit_callback returned true don't auto-close */
if (Z_TYPE(retval) == IS_TRUE) {