moriyoshi               Sun Jan 19 07:56:26 2003 EDT

  Added files:                 (Branch: PHP_4_3)
    /php4/ext/standard/tests/strings    bug21744.phpt 

  Modified files:              
    /php4/ext/standard  string.c 
  Log:
  MFH: fixed bug #21744
  
  
Index: php4/ext/standard/string.c
diff -u php4/ext/standard/string.c:1.333.2.9 php4/ext/standard/string.c:1.333.2.10
--- php4/ext/standard/string.c:1.333.2.9        Mon Jan  6 17:16:29 2003
+++ php4/ext/standard/string.c  Sun Jan 19 07:56:25 2003
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: string.c,v 1.333.2.9 2003/01/06 22:16:29 iliaa Exp $ */
+/* $Id: string.c,v 1.333.2.10 2003/01/19 12:56:25 moriyoshi Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -3515,8 +3515,16 @@
                                        state = 3;
                                        lc = c;
                                } else {
-                                       *(rp++) = c;
-                               }       
+                                       if (state == 0) {
+                                               *(rp++) = c;
+                                       } else if (allow && state == 1) {
+                                               *(tp++) = c;
+                                               if ( (tp-tbuf) >= PHP_TAG_BUF_SIZE ) {
+                                                       /* prevent buffer overflows */
+                                                       tp = tbuf;
+                                               }
+                                       }
+                               }
                                break;
 
                        case '?':

Index: php4/ext/standard/tests/strings/bug21744.phpt
+++ php4/ext/standard/tests/strings/bug21744.phpt
--TEST--
Bug #21744 (strip_tags misses exclamation marks in alt text)
--FILE--
<?php
$test = <<< HERE
<a href="test?test\\!!!test">test</a>
<!-- test -->
HERE;

print strip_tags($test, '');
print strip_tags($test, '<a>');
?>
--EXPECT--
test
<a href="test?test\!!!test">test</a>



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

Reply via email to