[packages/php4] Rel 85. Backport php-cgi PATH_INFO, session file and redirect fixes
arekm
arekm at pld-linux.org
Thu Nov 19 18:55:21 CET 2026
commit 8b42017be5c02035ec094cab5cbad189cdda2fe2
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Thu Nov 19 18:35:41 2026 +0100
Rel 85. Backport php-cgi PATH_INFO, session file and redirect fixes
Refresh php4-ini.patch line numbers so php.ini-dist.orig is no longer
shipped.
Fixes CVE-2026-129538, CVE-2026-128064, CVE-2026-126714.
php4-CVE-2026-126714.patch | 26 +++++++++++++++++++++
php4-CVE-2026-128064.patch | 29 ++++++++++++++++++++++++
php4-CVE-2026-129538.patch | 56 ++++++++++++++++++++++++++++++++++++++++++++++
php4-ini.patch | 6 ++---
php4.spec | 10 +++++++--
5 files changed, 122 insertions(+), 5 deletions(-)
---
diff --git a/php4.spec b/php4.spec
index ac420fa..698ee55 100644
--- a/php4.spec
+++ b/php4.spec
@@ -73,7 +73,7 @@
%undefine with_msession
%endif
-%define rel 84
+%define rel 85
Summary: PHP: Hypertext Preprocessor
Summary(fr.UTF-8): Le langage de script embarque-HTML PHP
Summary(pl.UTF-8): Język skryptowy PHP
@@ -86,7 +86,7 @@ Release: %{rel}%{?with_hardening:hardened}
Epoch: 3
License: PHP
Group: Libraries
-Source0: http://www.php.net/distributions/php-%{version}.tar.bz2
+Source0: https://www.php.net/distributions/php-%{version}.tar.bz2
# Source0-md5: 2e3b2a0e27f10cb84fd00e5ecd7a1880
Source3: %{name}-mod_php.conf
Source4: %{name}-cgi-fcgi.ini
@@ -263,6 +263,9 @@ Patch166: %{name}-CVE-2020-7059.patch
Patch167: %{name}-CVE-2011-1092.patch
Patch168: %{name}-CVE-2015-0232.patch
Patch169: %{name}-exif-zero-components.patch
+Patch170: %{name}-CVE-2026-129538.patch
+Patch171: %{name}-CVE-2026-126714.patch
+Patch172: %{name}-CVE-2026-128064.patch
URL: http://www.php.net/
%{?with_interbase:%{!?with_interbase_inst:BuildRequires: Firebird-devel >= 1.0.2.908-2}}
%{?with_pspell:BuildRequires: aspell-devel >= 2:0.50.0}
@@ -1875,6 +1878,9 @@ cp php.ini-dist php.ini
%patch -P167 -p1
%patch -P168 -p1
%patch -P169 -p1
+%patch -P170 -p1
+%patch -P171 -p1
+%patch -P172 -p1
%if %{with hardening}
zcat %{SOURCE8} | patch -p1
diff --git a/php4-CVE-2026-126714.patch b/php4-CVE-2026-126714.patch
new file mode 100644
index 0000000..4ce2d0b
--- /dev/null
+++ b/php4-CVE-2026-126714.patch
@@ -0,0 +1,26 @@
+CVE-2026-126714 (GHSA-fm2m-fjf5-v3cp): an interrupted session file write leaves the old data's tail behind, so the next read can unserialize attacker-arranged data.
+Upstream https://github.com/php/php-src/commit/41c0941ae27d
+
+diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
+index ba0ee6f..026eec5 100644
+--- a/ext/session/mod_files.c
++++ b/ext/session/mod_files.c
+@@ -335,13 +335,11 @@ PS_WRITE_FUNC(files)
+ if (data->fd < 0)
+ return FAILURE;
+
+- /*
+- * truncate file, if the amount of new data is smaller than
+- * the existing data set.
+- */
+-
+- if (vallen < (int)data->st_size)
+- ftruncate(data->fd, 0);
++ /* an interrupted write must not leave a tail of the old data behind */
++ if (ftruncate(data->fd, 0) != 0) {
++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "ftruncate() failed: %s (%d)", strerror(errno), errno);
++ return FAILURE;
++ }
+
+ #if defined(HAVE_PWRITE)
+ n = pwrite(data->fd, val, vallen, 0);
diff --git a/php4-CVE-2026-128064.patch b/php4-CVE-2026-128064.patch
new file mode 100644
index 0000000..378a187
--- /dev/null
+++ b/php4-CVE-2026-128064.patch
@@ -0,0 +1,29 @@
+CVE-2026-128064 (GHSA-f6gg-rchx-xw8j): http and ftp wrappers connect in plaintext for an HTTPS:// or FTPS:// URL with an uppercase S, reachable through a Location redirect.
+Upstream https://github.com/php/php-src/commit/cb68a63e8177
+
+diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
+index 2f7792d..3e56450 100644
+--- a/ext/standard/ftp_fopen_wrapper.c
++++ b/ext/standard/ftp_fopen_wrapper.c
+@@ -152,7 +152,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, ch
+ if (resource == NULL || resource->path == NULL)
+ return NULL;
+
+- use_ssl = resource->scheme && (strlen(resource->scheme) > 3) && resource->scheme[3] == 's';
++ use_ssl = resource->scheme && !strcasecmp(resource->scheme, "ftps");
+
+ /* use port 21 if one wasn't specified */
+ if (resource->port == 0)
+diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
+index d89129d..28780e1 100644
+--- a/ext/standard/http_fopen_wrapper.c
++++ b/ext/standard/http_fopen_wrapper.c
+@@ -120,7 +120,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
+ return php_stream_open_wrapper_ex(path, mode, ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context);
+ }
+
+- use_ssl = resource->scheme && (strlen(resource->scheme) > 4) && resource->scheme[4] == 's';
++ use_ssl = resource->scheme && !strcasecmp(resource->scheme, "https");
+
+ /* choose default ports */
+ if (use_ssl && resource->port == 0)
diff --git a/php4-CVE-2026-129538.patch b/php4-CVE-2026-129538.patch
new file mode 100644
index 0000000..619a51c
--- /dev/null
+++ b/php4-CVE-2026-129538.patch
@@ -0,0 +1,56 @@
+CVE-2026-129538 (GHSA-5j3f-64r7-f564): cgi.fix_pathinfo derives PATH_INFO from before its buffer when the stripped suffix is longer than PATH_INFO, and dereferences NULL when PATH_INFO is unset.
+Upstream https://github.com/php/php-src/commit/964cdcfa5adf; the NULL checks are from upstream PHP 5
+
+diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
+index 6c602dc..0234ed5 100644
+--- a/sapi/cgi/cgi_main.c
++++ b/sapi/cgi/cgi_main.c
+@@ -830,10 +830,12 @@ static void init_request_info(TSRMLS_D)
+ * out what SCRIPT_NAME should be
+ */
+ int slen = len - strlen(pt);
+- int pilen = strlen( env_path_info );
+- char *path_info = env_path_info + pilen - slen;
++ int pilen = env_path_info ? strlen( env_path_info ) : 0;
++ char *path_info = (env_path_info && pilen > slen) ? env_path_info + pilen - slen : NULL;
+
+- env_path_info = _sapi_cgibin_putenv("PATH_INFO",path_info TSRMLS_CC);
++ if (path_info) {
++ env_path_info = _sapi_cgibin_putenv("PATH_INFO",path_info TSRMLS_CC);
++ }
+ script_path_translated = _sapi_cgibin_putenv("SCRIPT_FILENAME",pt TSRMLS_CC);
+ TRANSLATE_SLASHES(pt);
+
+@@ -860,11 +862,13 @@ static void init_request_info(TSRMLS_D)
+ /*
+ * PATH_TRANSATED = DOCUMENT_ROOT + PATH_INFO
+ */
+- path_translated_len = l + strlen(env_path_info) + 2;
++ path_translated_len = l + (env_path_info ? strlen(env_path_info) : 0) + 2;
+ path_translated = (char *)emalloc(path_translated_len);
+ *path_translated = 0;
+ strncat(path_translated,env_document_root,l);
+- strcat(path_translated,env_path_info);
++ if (env_path_info) {
++ strcat(path_translated,env_path_info);
++ }
+ env_path_translated = _sapi_cgibin_putenv("PATH_TRANSLATED",path_translated TSRMLS_CC);
+ efree(path_translated);
+ } else if (env_script_name &&
+@@ -873,12 +877,14 @@ static void init_request_info(TSRMLS_D)
+ * PATH_TRANSATED = PATH_TRANSATED - SCRIPT_NAME + PATH_INFO
+ */
+ int ptlen = strlen(pt)-strlen(env_script_name);
+- int path_translated_len = ptlen + strlen(env_path_info) + 2;
++ int path_translated_len = ptlen + (env_path_info ? strlen(env_path_info) : 0) + 2;
+ char *path_translated = NULL;
+ path_translated = (char *)emalloc(path_translated_len);
+ *path_translated = 0;
+ strncat(path_translated,pt,ptlen);
+- strcat(path_translated,env_path_info);
++ if (env_path_info) {
++ strcat(path_translated,env_path_info);
++ }
+ env_path_translated = _sapi_cgibin_putenv("PATH_TRANSLATED",path_translated TSRMLS_CC);
+ efree(path_translated);
+ }
diff --git a/php4-ini.patch b/php4-ini.patch
index b295975..e27679d 100644
--- a/php4-ini.patch
+++ b/php4-ini.patch
@@ -255,7 +255,7 @@
;from="john at doe.com"
--- php-4.4.8/php.ini-dist~ 2008-07-02 18:50:01.000000000 +0300
+++ php-4.4.8/php.ini-dist 2008-07-02 18:56:09.636680270 +0300
-@@ -482,7 +482,7 @@
+@@ -418,7 +418,7 @@
; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root
; if you are running php as a CGI under any web server (other than IIS)
; see documentation for security issues. The alternate is to use the
@@ -264,7 +264,7 @@
doc_root =
; The directory under which PHP opens the script using /~username used only
-@@ -497,48 +497,6 @@
+@@ -433,48 +433,6 @@
; disabled on them.
enable_dl = On
@@ -313,7 +313,7 @@
;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;
-@@ -553,7 +511,6 @@
+@@ -489,7 +447,6 @@
; Maximum allowed size for uploaded files.
upload_max_filesize = 2M
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/php4.git/commitdiff/8b42017be5c02035ec094cab5cbad189cdda2fe2
More information about the pld-cvs-commit
mailing list