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.
This commit is contained in:
Nikita Popov 2017-02-25 12:55:14 +01:00
parent eac8166bd4
commit bbfa1b6419

View file

@ -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;