Commit:    4029475e82552a3ceddbdd343bdb5641eb269c50
Author:    Antony Dovgal <[email protected]>         Sun, 11 Nov 2012 22:37:04 
+0400
Parents:   80682bdcd82bcabb78fe3a22ccecb00df7b59d34
Branches:  master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=4029475e82552a3ceddbdd343bdb5641eb269c50

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 2ec2f62..0f76d7a 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--; \
+               } \
        } \
 }


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to