diff options
author | Antony Dovgal <tony2001@php.net> | 2012-11-11 22:37:04 +0400 |
---|---|---|
committer | Antony Dovgal <tony2001@php.net> | 2012-11-11 22:38:14 +0400 |
commit | 5b82fb52fd5143a3860db219eb39616c6e642a4b (patch) | |
tree | ff8a19ac9a73707e8802f4d5c0f24f13ccd1ad83 | |
parent | 964acdaa3527225d06beb8f81724513c9b9dd8dd (diff) | |
download | php-git-5b82fb52fd5143a3860db219eb39616c6e642a4b.tar.gz |
fix invalid read when trimming empty string
-rw-r--r-- | ext/filter/filter_private.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/filter/filter_private.h b/ext/filter/filter_private.h index 2ec2f62fae..0f76d7a032 100644 --- a/ext/filter/filter_private.h +++ b/ext/filter/filter_private.h @@ -109,8 +109,10 @@ if (len < 1 && return_if_empty) { \ RETURN_VALIDATION_FAILED \ } \ - while (p[len-1] == ' ' || p[len-1] == '\t' || p[len-1] == '\r' || p[len-1] == '\v' || p[len-1] == '\n') { \ - len--; \ + if (len > 0) { \ + while (p[len-1] == ' ' || p[len-1] == '\t' || p[len-1] == '\r' || p[len-1] == '\v' || p[len-1] == '\n') { \ + len--; \ + } \ } \ } |