summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2007-02-15 09:31:01 +0000
committerAntony Dovgal <tony2001@php.net>2007-02-15 09:31:01 +0000
commit25f51c3cbf78dd9ec4f6f006f89e1fbfa88f8f25 (patch)
tree1d79293208127f164e829cb898e2bd350cf186fc
parent3e1120f987858fd1e7afd86f03fb5be277b5e933 (diff)
downloadphp-git-25f51c3cbf78dd9ec4f6f006f89e1fbfa88f8f25.tar.gz
fix possible off-by-one in str_(i)replace()
-rw-r--r--ext/standard/string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 18821db8b4..5e671016d9 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -2531,7 +2531,7 @@ PHPAPI int php_char_to_str(char *str, uint len, char from, char *to, int to_len,
}
Z_STRLEN_P(result) = len + (char_count * (to_len - 1));
- Z_STRVAL_P(result) = target = safe_emalloc(char_count, to_len, len);
+ Z_STRVAL_P(result) = target = safe_emalloc(char_count, to_len, len + 1);
Z_TYPE_P(result) = IS_STRING;
for (source = str; source < source_end; source++) {