[PHP-CVS] cvs: php-src(PHP_5_3) /ext/filter logical_filters.c /ext/filter/tests bug46973.phpt

2009-06-10 Thread Felipe Pena
felipe  Wed Jun 10 19:01:17 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/filter logical_filters.c 
/php-src/ext/filter/tests   bug46973.phpt 
  Log:
  - MFH: Fix the fix (Bug #46973 - IPv6 address filter rejects valid address)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/filter/logical_filters.c?r1=1.1.2.22.2.11&r2=1.1.2.22.2.12&diff_format=u
Index: php-src/ext/filter/logical_filters.c
diff -u php-src/ext/filter/logical_filters.c:1.1.2.22.2.11 
php-src/ext/filter/logical_filters.c:1.1.2.22.2.12
--- php-src/ext/filter/logical_filters.c:1.1.2.22.2.11  Tue Mar 31 11:22:08 2009
+++ php-src/ext/filter/logical_filters.cWed Jun 10 19:01:17 2009
@@ -17,7 +17,7 @@
   +--+
 */
 
-/* $Id: logical_filters.c,v 1.1.2.22.2.11 2009/03/31 11:22:08 mattwil Exp $ */
+/* $Id: logical_filters.c,v 1.1.2.22.2.12 2009/06/10 19:01:17 felipe Exp $ */
 
 #include "php_filter.h"
 #include "filter_private.h"
@@ -570,7 +570,7 @@
}
if (*str == ':') {
if (compressed || --blocks == 0) {
-   return ipv4 != NULL;
+   return 0;
}   
if (++str == end || (ipv4 && ipv4 == str)) {
return 1;
http://cvs.php.net/viewvc.cgi/php-src/ext/filter/tests/bug46973.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u
Index: php-src/ext/filter/tests/bug46973.phpt
diff -u php-src/ext/filter/tests/bug46973.phpt:1.1.2.2 
php-src/ext/filter/tests/bug46973.phpt:1.1.2.3
--- php-src/ext/filter/tests/bug46973.phpt:1.1.2.2  Wed Dec 31 15:03:18 2008
+++ php-src/ext/filter/tests/bug46973.phpt  Wed Jun 10 19:01:17 2009
@@ -9,6 +9,6 @@
  
 ?>
 --EXPECTF--
-string(28) "1fff::a88:85a3::172.31.128.1"
+bool(false)
 string(39) "3ffe:6a88:85a3:08d3:1319:8a2e:0370:7344"
-string(28) "1fff::a88:85a3::172.31.128.1"
+bool(false)



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/filter logical_filters.c /ext/filter/tests bug46973.phpt

2008-12-31 Thread Felipe Pena
felipe  Wed Dec 31 15:03:18 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/filter/tests   bug46973.phpt 

  Modified files:  
/php-src/ext/filter logical_filters.c 
  Log:
  - MFH: Fixed bug #46973 (IPv6 address filter rejects valid address)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/filter/logical_filters.c?r1=1.1.2.22.2.4&r2=1.1.2.22.2.5&diff_format=u
Index: php-src/ext/filter/logical_filters.c
diff -u php-src/ext/filter/logical_filters.c:1.1.2.22.2.4 
php-src/ext/filter/logical_filters.c:1.1.2.22.2.5
--- php-src/ext/filter/logical_filters.c:1.1.2.22.2.4   Wed Dec 31 11:15:36 2008
+++ php-src/ext/filter/logical_filters.cWed Dec 31 15:03:18 2008
@@ -17,7 +17,7 @@
   +--+
 */
 
-/* $Id: logical_filters.c,v 1.1.2.22.2.4 2008/12/31 11:15:36 sebastian Exp $ */
+/* $Id: logical_filters.c,v 1.1.2.22.2.5 2008/12/31 15:03:18 felipe Exp $ */
 
 #include "php_filter.h"
 #include "filter_private.h"
@@ -526,7 +526,7 @@
int compressed = 0;
int blocks = 8;
int n;
-   char *ipv4;
+   char *ipv4 = NULL;
char *end;
int ip4elm[4];
char *s = str;
@@ -552,20 +552,24 @@
blocks = 6;
}
 
-   end = str + str_len;
+   end = ipv4 ? ipv4 : str + str_len;
+
while (str < end) {
if (*str == ':') {
if (--blocks == 0) {
+   if ((str+1) == end && ipv4) {
+   return 1;
+   }
return 0;
}   
if (++str >= end) {
-   return 0;
+   return (ipv4 && ipv4 == str && blocks == 3) || 
0;
}
if (*str == ':') {
if (compressed || --blocks == 0) {
-   return 0;
+   return ipv4 != NULL;
}   
-   if (++str == end) {
+   if (++str == end || (ipv4 && ipv4 == str)) {
return 1;
}
compressed = 1;

http://cvs.php.net/viewvc.cgi/php-src/ext/filter/tests/bug46973.phpt?view=markup&rev=1.1
Index: php-src/ext/filter/tests/bug46973.phpt
+++ php-src/ext/filter/tests/bug46973.phpt
--TEST--
Bug #46973 (IPv6 address filter rejects valid address)
--FILE--

--EXPECTF--
string(28) "1fff::a88:85a3::172.31.128.1"
string(39) "3ffe:6a88:85a3:08d3:1319:8a2e:0370:7344"
string(28) "1fff::a88:85a3::172.31.128.1"



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