diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2010-12-12 18:36:21 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2010-12-12 18:36:21 +0000 |
commit | c6bbf9ee57c39ade0563abd2e44ccd7d6f35fca0 (patch) | |
tree | c54d3d9116940ef0087987e5d7190edc190793e8 /ext/filter/logical_filters.c | |
parent | a7d8c0e2a5bd2d19a86163b3c5c541c46d292754 (diff) | |
download | php-git-c6bbf9ee57c39ade0563abd2e44ccd7d6f35fca0.tar.gz |
Fixed bug #53150 (FILTER_FLAG_NO_RES_RANGE is missing some IP ranges)
Diffstat (limited to 'ext/filter/logical_filters.c')
-rw-r--r-- | ext/filter/logical_filters.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c index 6bf83b9cef..f6a7c82fd2 100644 --- a/ext/filter/logical_filters.c +++ b/ext/filter/logical_filters.c @@ -710,8 +710,11 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ if (flags & FILTER_FLAG_NO_RES_RANGE) { if ( (ip[0] == 0) || + (ip[0] == 128 && ip[1] == 0) || + (ip[0] == 191 && ip[1] == 255) || (ip[0] == 169 && ip[1] == 254) || (ip[0] == 192 && ip[1] == 0 && ip[2] == 2) || + (ip[0] == 127 && ip[1] == 0 && ip[2] == 0 && ip[3] == 1) || (ip[0] >= 224 && ip[0] <= 255) ) { RETURN_VALIDATION_FAILED @@ -732,6 +735,9 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ RETURN_VALIDATION_FAILED } } + if (flags & FILTER_FLAG_NO_RES_RANGE && Z_STRLEN_P(value) == 3 && !strcmp("::1", Z_STRVAL_P(value))) { + RETURN_VALIDATION_FAILED + } } break; } |