Skip to content

Commit 970ac28

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Fix #73527: Invalid memory access in php_filter_strip
2 parents 58801f7 + d65c853 commit 970ac28

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ext/filter/sanitizing_filters.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static void php_filter_strip(zval *value, zend_long flags)
9898
{
9999
unsigned char *str;
100100
size_t i;
101-
int c;
101+
size_t c;
102102
zend_string *buf;
103103

104104
/* Optimization for if no strip flags are set */
@@ -107,7 +107,7 @@ static void php_filter_strip(zval *value, zend_long flags)
107107
}
108108

109109
str = (unsigned char *)Z_STRVAL_P(value);
110-
buf = zend_string_alloc(Z_STRLEN_P(value) + 1, 0);
110+
buf = zend_string_alloc(Z_STRLEN_P(value), 0);
111111
c = 0;
112112
for (i = 0; i < Z_STRLEN_P(value); i++) {
113113
if ((str[i] >= 127) && (flags & FILTER_FLAG_STRIP_HIGH)) {
@@ -149,7 +149,7 @@ static void filter_map_apply(zval *value, filter_map *map)
149149
zend_string *buf;
150150

151151
str = (unsigned char *)Z_STRVAL_P(value);
152-
buf = zend_string_alloc(Z_STRLEN_P(value) + 1, 0);
152+
buf = zend_string_alloc(Z_STRLEN_P(value), 0);
153153
c = 0;
154154
for (i = 0; i < Z_STRLEN_P(value); i++) {
155155
if ((*map)[str[i]]) {

0 commit comments

Comments
 (0)