From bbfa1b64192fe3ccd2898e6e1f997387b4f210d1 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 25 Feb 2017 12:55:14 +0100 Subject: Improve fix for bug #73807 At least on some architectures memmove() on FreeBSD does not short-curcuit if src==dst. Check for it explicitly to avoid quadratic copying. --- main/php_variables.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'main/php_variables.c') diff --git a/main/php_variables.c b/main/php_variables.c index aa6e426ba3..d3cfb7f737 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -311,7 +311,7 @@ static inline int add_post_vars(zval *arr, post_var_data_t *vars, zend_bool eof) } } - if (!eof) { + if (!eof && ZSTR_VAL(vars->str.s) != vars->ptr) { memmove(ZSTR_VAL(vars->str.s), vars->ptr, ZSTR_LEN(vars->str.s) = vars->end - vars->ptr); } return SUCCESS; -- cgit v1.2.1