summaryrefslogtreecommitdiff
path: root/ext/filter/sanitizing_filters.c
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-06-04 13:40:16 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2020-06-04 13:40:16 +0200
commit970ac28e274b7edcd46bad4588d40d444d4f9074 (patch)
tree1bd11ea8274e1e04187476c7fbf9fb8919fc37b4 /ext/filter/sanitizing_filters.c
parent58801f7142861bdd3c7b8c7dc39a75a532dd25bf (diff)
parentd65c85366dbf03c10f913358b2017931291a61ed (diff)
downloadphp-git-970ac28e274b7edcd46bad4588d40d444d4f9074.tar.gz
Merge branch 'PHP-7.4'
* PHP-7.4: Fix #73527: Invalid memory access in php_filter_strip
Diffstat (limited to 'ext/filter/sanitizing_filters.c')
-rw-r--r--ext/filter/sanitizing_filters.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/filter/sanitizing_filters.c b/ext/filter/sanitizing_filters.c
index 9243b419cf..cceb1270bb 100644
--- a/ext/filter/sanitizing_filters.c
+++ b/ext/filter/sanitizing_filters.c
@@ -98,7 +98,7 @@ static void php_filter_strip(zval *value, zend_long flags)
{
unsigned char *str;
size_t i;
- int c;
+ size_t c;
zend_string *buf;
/* Optimization for if no strip flags are set */
@@ -107,7 +107,7 @@ static void php_filter_strip(zval *value, zend_long flags)
}
str = (unsigned char *)Z_STRVAL_P(value);
- buf = zend_string_alloc(Z_STRLEN_P(value) + 1, 0);
+ buf = zend_string_alloc(Z_STRLEN_P(value), 0);
c = 0;
for (i = 0; i < Z_STRLEN_P(value); i++) {
if ((str[i] >= 127) && (flags & FILTER_FLAG_STRIP_HIGH)) {
@@ -149,7 +149,7 @@ static void filter_map_apply(zval *value, filter_map *map)
zend_string *buf;
str = (unsigned char *)Z_STRVAL_P(value);
- buf = zend_string_alloc(Z_STRLEN_P(value) + 1, 0);
+ buf = zend_string_alloc(Z_STRLEN_P(value), 0);
c = 0;
for (i = 0; i < Z_STRLEN_P(value); i++) {
if ((*map)[str[i]]) {