diff options
author | SVN Migration <svn@php.net> | 2006-11-01 01:55:12 +0000 |
---|---|---|
committer | SVN Migration <svn@php.net> | 2006-11-01 01:55:12 +0000 |
commit | 845610d1b58fc3b9e4127c8fd277a9d56a9874c2 (patch) | |
tree | 16bc6901ab6b6113725131e8bcdf5ded1de02f91 /ext | |
parent | d584c0a6f42b04bdc16650a35e7d004da54eb960 (diff) | |
download | php-git-php-5.2.0.tar.gz |
This commit was manufactured by cvs2svn to create tag 'php_5_2_0'.php-5.2.0
Diffstat (limited to 'ext')
-rw-r--r-- | ext/standard/html.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/ext/standard/html.c b/ext/standard/html.c index fdb0eb4fef..f2a6f72aa1 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -1105,7 +1105,7 @@ PHPAPI char *php_escape_html_entities(unsigned char *old, int oldlen, int *newle matches_map = 0; - if (len + 9 > maxlen) + if (len + 16 > maxlen) replaced = erealloc (replaced, maxlen += 128); if (all) { @@ -1130,9 +1130,15 @@ PHPAPI char *php_escape_html_entities(unsigned char *old, int oldlen, int *newle } if (matches_map) { + int l = strlen(rep); + /* increase the buffer size */ + if (len + 2 + l >= maxlen) { + replaced = erealloc(replaced, maxlen += 128); + } + replaced[len++] = '&'; strcpy(replaced + len, rep); - len += strlen(rep); + len += l; replaced[len++] = ';'; } } |