com php-src: fix invalid read when trimming empty string: ext/filter/filter_private.h
| From: | Antony Dovgal | Date: | Sun, 11 Nov 2012 18:37:04 +0000 |
| Subject: | com php-src: fix invalid read when trimming empty string: ext/filter/filter_private.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-70518@lists.php.net to get a copy of this message | ||
Commit: bb60122c2fe49985b35026ecc48ff6cf550fbac1
Author: Antony Dovgal <tony2001@php.net> Sun, 11 Nov 2012 22:37:04 +0400
Parents: 065862a750a4c7b20d580b4e32a9df62b00b90a0
Branches: PHP-5.3
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=bb60122c2fe49985b35026ecc48ff6cf550fbac1
Log:
fix invalid read when trimming empty string
Changed paths:
M ext/filter/filter_private.h
Diff:
diff --git a/ext/filter/filter_private.h b/ext/filter/filter_private.h
index daa688b..6c26d98 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--; \
+ } \
} \
}