]> granicus.if.org Git - php/commitdiff
MFB:Fixed bug #46343 (IPv6 address filter accepts invalid address)
authorIlia Alshanetsky <iliaa@php.net>
Mon, 20 Oct 2008 23:23:45 +0000 (23:23 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Mon, 20 Oct 2008 23:23:45 +0000 (23:23 +0000)
NEWS
ext/filter/logical_filters.c

diff --git a/NEWS b/NEWS
index 17f79f8046d555161b892fcfbfce5d225dc20e78..62e87c44e03cab18e7d2e5ceef6e0db76b93a7db 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? Oct 2008, PHP 5.2.7RC2
+- Fixed bug #46343 (IPv6 address filter accepts invalid address). (Ilia)
 - Fixed bug #46341 (Added missing validation checks into define() for class
   constants). (Ilia)
 - Fixed bug #46335 (DOMText::splitText doesn't handle multibyte characters).
index 36317e8311225e37596e5725ce27ee66679c3fe0..7f7cfbc688e4fc0945a212643b3c34efcf7b37ad 100644 (file)
@@ -529,6 +529,7 @@ static int _php_filter_validate_ipv6(char *str, int str_len TSRMLS_DC) /* {{{ */
        char *ipv4;
        char *end;
        int ip4elm[4];
+       char *s = str;
 
        if (!memchr(str, ':', str_len)) {
                return 0;
@@ -568,6 +569,8 @@ static int _php_filter_validate_ipv6(char *str, int str_len TSRMLS_DC) /* {{{ */
                                        return 1;
                                }
                                compressed = 1;
+                       } else if ((str - 1) == s) {
+                               return 0;
                        }                               
                }
                n = 0;