]> granicus.if.org Git - php/commitdiff
- #8315, NULL character stops the validation
authorPierre Joye <pajoye@php.net>
Sat, 29 Jul 2006 01:26:55 +0000 (01:26 +0000)
committerPierre Joye <pajoye@php.net>
Sat, 29 Jul 2006 01:26:55 +0000 (01:26 +0000)
ext/filter/logical_filters.c
ext/filter/package.xml
ext/filter/tests/bug8315.phpt [new file with mode: 0644]

index 4887c64d70c49e179e87f833b2eb4d312a38cfda..c299d13e59bb6757c6e50c755561f2041746d7c0 100644 (file)
@@ -119,6 +119,7 @@ void php_filter_int(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
                }
                i++;
                p[i] = '\0';
+               end = p + i - 1;
        }
 
        /* state 0 */
@@ -189,7 +190,7 @@ stateH1: /* state "hex 1" */
        }
 
 stateT: /* state "tail" */
-       if (*p != '\0') {
+       if (*p != '\0' || (p-1) != end) {
                goto stateE;
        } else {
                goto stateR;
index cca5fd6a8cf1d8b771d1bac7c4ac5347a65964a4..45c38703df047f8760d5dc4bb7feaa742f4ada21 100644 (file)
@@ -26,10 +26,11 @@ of filters and mechanisms that users can use to safely access their input data.
     <state>beta</state>
     <version>0.10.0</version>
     <date>2006-05-14</date>
-    <notes>- Fixed PECL bug #6136, ini_set should not be able to change the filter.default (Pierre)
-- Fixed PECL bug #6639: uppercase hexadecimal digits are not supported
+    <notes>- Fixed PECL bug #8315, NULL character stops the validation (Pierre)
 - Fixed PECL bug #7733, Float exponential weird result (Pierre)
 - Fixed PECL bug #7715, Input_get float error (Pierre)
+- Fixed PECL bug #6639: uppercase hexadecimal digits are not supported
+- Fixed PECL bug #6136, ini_set should not be able to change the filter.default (Pierre)
 - Implemented PECL req #6641: negative values for hexadecimal and octal numbers are not supported.
 - Added support for php pcre expressions (Pierre)
 - Fixed Possible leak in internal sapi_filter (Pierre)
diff --git a/ext/filter/tests/bug8315.phpt b/ext/filter/tests/bug8315.phpt
new file mode 100644 (file)
index 0000000..5e65590
--- /dev/null
@@ -0,0 +1,10 @@
+--TEST--
+bug 8315, NULL values halt the validation 
+--FILE--
+<?php
+
+$var="3".chr(0)."foo";
+var_dump(filter_data($var, FILTER_VALIDATE_INT));
+?>
+--EXPECTF--    
+bool(false)