summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2012-11-11 22:37:04 +0400
committerAntony Dovgal <tony2001@php.net>2012-11-11 22:37:04 +0400
commitbb60122c2fe49985b35026ecc48ff6cf550fbac1 (patch)
tree578b04449d14d3c46ac3350e5055523a543bb5cf
parent065862a750a4c7b20d580b4e32a9df62b00b90a0 (diff)
downloadphp-git-bb60122c2fe49985b35026ecc48ff6cf550fbac1.tar.gz
fix invalid read when trimming empty string
-rw-r--r--ext/filter/filter_private.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/filter/filter_private.h b/ext/filter/filter_private.h
index daa688b4ac..6c26d98075 100644
--- a/ext/filter/filter_private.h
+++ b/ext/filter/filter_private.h
@@ -107,8 +107,10 @@
if (len < 1) { \
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--; \
+ } \
} \
}