[php-src] master: Merge branch 'PHP-8.6'
| From: | Daniel Scherzer | Date: | Mon, 19 Oct 2026 19:04:54 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.6' | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-142464@lists.php.net to get a copy of this message | ||
Author: Daniel Scherzer (DanielEScherzer)
Date: 2026-10-19T12:03:59-07:00
Commit: https://github.com/php/php-src/commit/3115bd9b757f0fbee3fdb412c9bcdd3a5ebbeb93
Raw diff: https://github.com/php/php-src/commit/3115bd9b757f0fbee3fdb412c9bcdd3a5ebbeb93.diff
Merge branch 'PHP-8.6'
* PHP-8.6:
php_ftp_fopen_connect(): Confirm no extra commands are smuggled in (#23856)
Changed paths:
M ext/standard/ftp_fopen_wrapper.c
Diff:
diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
index cf529e40085b..97879a5c7000 100644
--- a/ext/standard/ftp_fopen_wrapper.c
+++ b/ext/standard/ftp_fopen_wrapper.c
@@ -142,6 +142,14 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const
char
return NULL;
}
+ /* Searching for a substring is a bit expensive, and this is just a
+ * hardening assertion to confirm php_uri_parse_to_struct() stripped any
+ * CRLF sequence, only run in debug mode. */
+#if ZEND_DEBUG
+ char *pos = strstr(ZSTR_VAL(resource->path), "\r\n");
+ ZEND_ASSERT(pos == NULL);
+#endif
+
use_ssl = resource->scheme && (ZSTR_LEN(resource->scheme) > 3) &&
ZSTR_VAL(resource->scheme)[3] == 's';
/* use port 21 if one wasn't specified */