moriyoshi               Mon Feb 24 17:01:13 2003 EDT

  Modified files:              
    /php4/ext/standard  php_string.h string.c 
  Log:
  Made strip_tags() binary safe
  
  
Index: php4/ext/standard/php_string.h
diff -u php4/ext/standard/php_string.h:1.71 php4/ext/standard/php_string.h:1.72
--- php4/ext/standard/php_string.h:1.71 Tue Feb 11 17:47:26 2003
+++ php4/ext/standard/php_string.h      Mon Feb 24 17:01:11 2003
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_string.h,v 1.71 2003/02/11 22:47:26 iliaa Exp $ */
+/* $Id: php_string.h,v 1.72 2003/02/24 22:01:11 moriyoshi Exp $ */
 
 /* Synced with php 3.0 revision 1.43 1999-06-16 [ssb] */
 
@@ -129,7 +129,7 @@
 PHPAPI char *php_str_to_str(char *haystack, int length, char *needle,
                int needle_len, char *str, int str_len, int *_new_length);
 PHPAPI char *php_trim(char *c, int len, char *what, int what_len, zval *return_value, 
int mode TSRMLS_DC);
-PHPAPI void php_strip_tags(char *rbuf, int len, int *state, char *allow, int 
allow_len);
+PHPAPI size_t php_strip_tags(char *rbuf, int len, int *state, char *allow, int 
allow_len);
 PHPAPI int php_char_to_str(char *str, uint len, char from, char *to, int to_len, pval 
*result);
 PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value);
 PHPAPI void php_explode(zval *delim, zval *str, zval *return_value, int limit);
Index: php4/ext/standard/string.c
diff -u php4/ext/standard/string.c:1.359 php4/ext/standard/string.c:1.360
--- php4/ext/standard/string.c:1.359    Tue Feb 18 13:11:34 2003
+++ php4/ext/standard/string.c  Mon Feb 24 17:01:12 2003
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: string.c,v 1.359 2003/02/18 18:11:34 moriyoshi Exp $ */
+/* $Id: string.c,v 1.360 2003/02/24 22:01:12 moriyoshi Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -3299,6 +3299,7 @@
        zval **str, **allow=NULL;
        char *allowed_tags=NULL;
        int allowed_tags_len=0;
+       size_t retval_len;
 
        switch (ZEND_NUM_ARGS()) {
                case 1:
@@ -3320,8 +3321,8 @@
        }
        convert_to_string_ex(str);
        buf = estrndup(Z_STRVAL_PP(str), Z_STRLEN_PP(str));
-       php_strip_tags(buf, Z_STRLEN_PP(str), NULL, allowed_tags, allowed_tags_len);
-       RETURN_STRING(buf, 0);
+       retval_len = php_strip_tags(buf, Z_STRLEN_PP(str), NULL, allowed_tags, 
allowed_tags_len);
+       RETURN_STRINGL(buf, retval_len, 0);
 }
 /* }}} */
 
@@ -3555,7 +3556,7 @@
        swm: Added ability to strip <?xml tags without assuming it PHP
        code.
 */
-PHPAPI void php_strip_tags(char *rbuf, int len, int *stateptr, char *allow, int 
allow_len)
+PHPAPI size_t php_strip_tags(char *rbuf, int len, int *stateptr, char *allow, int 
allow_len)
 {
        char *tbuf, *buf, *p, *tp, *rp, c, lc;
        int br, i=0, depth=0;
@@ -3751,6 +3752,8 @@
                efree(tbuf);
        if (stateptr)
                *stateptr = state;
+
+       return (size_t)(rp - rbuf);
 }
 /* }}} */
 



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

Reply via email to