summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2016-09-13 11:51:17 +0200
committerAnatol Belski <ab@php.net>2016-09-13 11:51:17 +0200
commit2088e3eb45ebed1b9eb0f6b3fe258820a0021e5f (patch)
tree5569d61d17abce09a3cdc2176491851f917b4271
parent0dd2f072b1b9a579777f4a3aa026d5f9004b8fbe (diff)
parentc403b3029123aefe0919058b100e80c6bc4e1a6d (diff)
downloadphp-git-2088e3eb45ebed1b9eb0f6b3fe258820a0021e5f.tar.gz
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0: pick up the safe alloc pieces from 19866fb76cf4c95d904ebb0e08592cf38303fae9
-rw-r--r--ext/imap/php_imap.c2
-rw-r--r--ext/standard/string.c8
2 files changed, 5 insertions, 5 deletions
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c
index 9416a7e34d..7b4d31143a 100644
--- a/ext/imap/php_imap.c
+++ b/ext/imap/php_imap.c
@@ -2977,7 +2977,7 @@ PHP_FUNCTION(imap_utf7_encode)
}
/* allocate output buffer */
- out = zend_string_alloc(outlen, 0);
+ out = zend_string_safe_alloc(1, outlen, 0, 0);
/* encode input string */
outp = (unsigned char*)ZSTR_VAL(out);
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 5e6b207265..c41d48ef17 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -2500,7 +2500,7 @@ PHP_FUNCTION(substr_replace)
repl_str = Z_STR_P(repl);
}
- result = zend_string_alloc(Z_STRLEN_P(str) - l + ZSTR_LEN(repl_str), 0);
+ result = zend_string_safe_alloc(1, Z_STRLEN_P(str) - l + ZSTR_LEN(repl_str), 0, 0);
memcpy(ZSTR_VAL(result), Z_STRVAL_P(str), f);
if (ZSTR_LEN(repl_str)) {
@@ -2609,14 +2609,14 @@ PHP_FUNCTION(substr_replace)
result_len += ZSTR_LEN(repl_str);
repl_idx++;
- result = zend_string_alloc(result_len, 0);
+ result = zend_string_safe_alloc(1, result_len, 0, 0);
memcpy(ZSTR_VAL(result), ZSTR_VAL(orig_str), f);
memcpy((ZSTR_VAL(result) + f), ZSTR_VAL(repl_str), ZSTR_LEN(repl_str));
memcpy((ZSTR_VAL(result) + f + ZSTR_LEN(repl_str)), ZSTR_VAL(orig_str) + f + l, ZSTR_LEN(orig_str) - f - l);
zend_string_release(repl_str);
} else {
- result = zend_string_alloc(result_len, 0);
+ result = zend_string_safe_alloc(1, result_len, 0, 0);
memcpy(ZSTR_VAL(result), ZSTR_VAL(orig_str), f);
memcpy((ZSTR_VAL(result) + f), ZSTR_VAL(orig_str) + f + l, ZSTR_LEN(orig_str) - f - l);
@@ -2624,7 +2624,7 @@ PHP_FUNCTION(substr_replace)
} else {
result_len += Z_STRLEN_P(repl);
- result = zend_string_alloc(result_len, 0);
+ result = zend_string_safe_alloc(1, result_len, 0, 0);
memcpy(ZSTR_VAL(result), ZSTR_VAL(orig_str), f);
memcpy((ZSTR_VAL(result) + f), Z_STRVAL_P(repl), Z_STRLEN_P(repl));