com php-src: pick up the safe alloc pieces from 19866fb76cf4c95d904ebb0e08592cf38303fae9: ext/imap/php_imap .c ext/standard/string.c

From: Date: Tue, 13 Sep 2016 09:50:18 +0000
Subject: com php-src: pick up the safe alloc pieces from 19866fb76cf4c95d904ebb0e08592cf38303fae9: ext/imap/php_imap .c ext/standard/string.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-94472@lists.php.net to get a copy of this message
Commit: c403b3029123aefe0919058b100e80c6bc4e1a6d Author: Anatol Belski <ab@php.net> Tue, 13 Sep 2016 11:50:18 +0200 Parents: 01f6a0a8608f19477c3f78ff980957a359a9e34c Branches: PHP-7.0 PHP-7.1 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c403b3029123aefe0919058b100e80c6bc4e1a6d Log: pick up the safe alloc pieces from 19866fb76cf4c95d904ebb0e08592cf38303fae9 Changed paths: M ext/imap/php_imap.c M ext/standard/string.c Diff: diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index 5cfc8ad..566392f 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 c3becb9..491e97a 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -2490,7 +2490,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)) { @@ -2599,14 +2599,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); @@ -2614,7 +2614,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));

« previous php.cvs (#94472) next »