php: fix CVE-2017-9120

Signed-off-by: Changqing Li <changqing.li@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Changqing Li 2018-08-21 14:01:20 +08:00 committed by Khem Raj
parent 7c819ae30d
commit 0d59551c95
2 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,21 @@
php: patch for CVE-2017-9120
Upstream-Status: Backport [https://bugs.php.net/bug.php?id=74544]
CVE: CVE-2017-9120
Signed-off-by: Changqing Li <changqing.li@windriver.com>
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index 03a39d7..7b88731 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -1965,7 +1965,7 @@ PHP_FUNCTION(mysqli_real_escape_string) {
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
- newstr = zend_string_alloc(2 * escapestr_len, 0);
+ newstr = zend_string_safe_alloc(2, escapestr_len, 0, 0);
ZSTR_LEN(newstr) = mysql_real_escape_string(mysql->mysql, ZSTR_VAL(newstr), escapestr, escapestr_len);
newstr = zend_string_truncate(newstr, ZSTR_LEN(newstr), 0);

View File

@ -5,6 +5,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=67e369bc8d1f2e641236b8002039a6a2"
SRC_URI += "file://change-AC_TRY_RUN-to-AC_TRY_LINK.patch \
file://0001-acinclude.m4-skip-binconfig-check-for-libxml.patch \
file://0001-fix-error-caused-by-a-new-variable-is-declared-after.patch \
file://CVE-2017-9120.patch \
"
SRC_URI_append_class-target = " \
file://pear-makefile.patch \