summaryrefslogtreecommitdiff
path: root/ext/standard/html.c
diff options
context:
space:
mode:
authorGustavo André dos Santos Lopes <cataphract@php.net>2010-10-27 18:13:25 +0000
committerGustavo André dos Santos Lopes <cataphract@php.net>2010-10-27 18:13:25 +0000
commite69b1ff2c43fbfd672097e9f8b25dead81f34ccf (patch)
tree50dd9955cf078bbeefd120d86d09aec99c9db7cd /ext/standard/html.c
parentda400e7500e236a332b8104b373e60e842bbd63e (diff)
downloadphp-git-e69b1ff2c43fbfd672097e9f8b25dead81f34ccf.tar.gz
- Fixed bug #49687 (utf8_decode vulnerabilities and deficiencies in the number
of reported malformed sequences). (Gustavo) #Made a public interface for get_next_char/utf-8 in trunk to use in utf8_decode. #In PHP 5.3, trunk's get_next_char was copied to xml.c because 5.3's #get_next_char is different and is not prepared to recover appropriately from #errors.
Diffstat (limited to 'ext/standard/html.c')
-rw-r--r--ext/standard/html.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/ext/standard/html.c b/ext/standard/html.c
index 354e18bfec..de763cf72a 100644
--- a/ext/standard/html.c
+++ b/ext/standard/html.c
@@ -92,9 +92,9 @@ ZEND_EXTERN_MODULE_GLOBALS(mbstring)
/* {{{ get_next_char
*/
-static unsigned int get_next_char(
+static inline unsigned int get_next_char(
enum entity_charset charset,
- unsigned char *str,
+ const unsigned char *str,
size_t str_len,
size_t *cursor,
int *status)
@@ -352,6 +352,18 @@ static unsigned int get_next_char(
}
/* }}} */
+/* {{{ php_next_utf8_char
+ * Public interface for get_next_char used with UTF-8 */
+ PHPAPI unsigned int php_next_utf8_char(
+ const unsigned char *str,
+ size_t str_len,
+ size_t *cursor,
+ int *status)
+{
+ return get_next_char(cs_utf_8, str, str_len, cursor, status);
+}
+/* }}} */
+
/* {{{ entity_charset determine_charset
* returns the charset identifier based on current locale or a hint.
* defaults to UTF-8 */