blob: 6ce8f021bfa6c51c9e909dcce93e6ba1ecc9bb0c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
Backported for 5.5 from:
From c69bcb212b37900fd61daaf38762e4974cb4dcc9 Mon Sep 17 00:00:00 2001
From: Jakub Zelenka <bukka@php.net>
Date: Sat, 12 Oct 2019 15:56:16 +0100
Subject: [PATCH 1/2] Fix bug #78599 (env_path_info underflow can lead to RCE)
(CVE-2019-11043)
cheery-picked from ab061f95ca966731b1c84cf5b7b20155c0a1c06a
without the test as tester not available
---
sapi/fpm/fpm/fpm_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c
index d12ac01859..22b889c167 100644
--- a/sapi/fpm/fpm/fpm_main.c
+++ b/sapi/fpm/fpm/fpm_main.c
@@ -1214,8 +1214,8 @@ static void init_request_info(TSRMLS_D)
path_info = script_path_translated + ptlen;
tflag = (slen != 0 && (!orig_path_info || strcmp(orig_path_info, path_info) != 0));
} else {
- path_info = env_path_info ? env_path_info + pilen - slen : NULL;
- tflag = (orig_path_info != path_info);
+ path_info = (env_path_info && pilen > slen) ? env_path_info + pilen - slen : NULL;
+ tflag = path_info && (orig_path_info != path_info);
}
if (tflag) {
|