Skip to content

Commit 606829f

Browse files
committed
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: Fix #74544: Integer overflow in mysqli_real_escape_string()
2 parents 4aeff60 + 5977610 commit 606829f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ PHP NEWS
2525
- GD:
2626
. Fixed bug #51498 (imagefilledellipse does not work for large circles). (cmb)
2727

28+
- MySQLi:
29+
. Fixed bug #74544 (Integer overflow in mysqli_real_escape_string()). (cmb,
30+
johannes)
31+
2832
- Opcache:
2933
. Fixed bug #81225 (Wrong result with pow operator with JIT enabled).
3034
(Dmitry)

ext/mysqli/mysqli_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1894,7 +1894,7 @@ PHP_FUNCTION(mysqli_real_escape_string) {
18941894
}
18951895
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
18961896

1897-
newstr = zend_string_alloc(2 * escapestr_len, 0);
1897+
newstr = zend_string_safe_alloc(2, escapestr_len, 0, 0);
18981898
ZSTR_LEN(newstr) = mysql_real_escape_string_quote(mysql->mysql, ZSTR_VAL(newstr), escapestr, escapestr_len, '\'');
18991899
newstr = zend_string_truncate(newstr, ZSTR_LEN(newstr), 0);
19001900

0 commit comments

Comments
 (0)