]> 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:53 +0000 (23:23 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Mon, 20 Oct 2008 23:23:53 +0000 (23:23 +0000)
ext/filter/logical_filters.c

index 211d2c7cf07c9f0f112a0ff30f75d7bc031c3810..df746b266f55a439c7c4b2e017824687d0249b2f 100644 (file)
@@ -533,6 +533,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;
@@ -572,6 +573,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;