Skip to content

Commit d65c853

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #73527: Invalid memory access in php_filter_strip
2 parents a230717 + ceae816 commit d65c853

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ PHP NEWS
88
. Fixed bug #79668 (get_defined_functions(true) may miss functions). (cmb,
99
Nikita)
1010

11+
- Filter:
12+
. Fixed bug #73527 (Invalid memory access in php_filter_strip). (cmb)
13+
1114
- PDO SQLite:
1215
. Fixed bug #79664 (PDOStatement::getColumnMeta fails on empty result set).
1316
(cmb)

ext/filter/sanitizing_filters.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ static void php_filter_strip(zval *value, zend_long flags)
110110
{
111111
unsigned char *str;
112112
size_t i;
113-
int c;
113+
size_t c;
114114
zend_string *buf;
115115

116116
/* Optimization for if no strip flags are set */
@@ -119,7 +119,7 @@ static void php_filter_strip(zval *value, zend_long flags)
119119
}
120120

121121
str = (unsigned char *)Z_STRVAL_P(value);
122-
buf = zend_string_alloc(Z_STRLEN_P(value) + 1, 0);
122+
buf = zend_string_alloc(Z_STRLEN_P(value), 0);
123123
c = 0;
124124
for (i = 0; i < Z_STRLEN_P(value); i++) {
125125
if ((str[i] >= 127) && (flags & FILTER_FLAG_STRIP_HIGH)) {
@@ -161,7 +161,7 @@ static void filter_map_apply(zval *value, filter_map *map)
161161
zend_string *buf;
162162

163163
str = (unsigned char *)Z_STRVAL_P(value);
164-
buf = zend_string_alloc(Z_STRLEN_P(value) + 1, 0);
164+
buf = zend_string_alloc(Z_STRLEN_P(value), 0);
165165
c = 0;
166166
for (i = 0; i < Z_STRLEN_P(value); i++) {
167167
if ((*map)[str[i]]) {

0 commit comments

Comments
 (0)