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 10:26:23 +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-94484@lists.php.net to get a copy of this message
Commit: 18b6f6ee016d558aafb9e7653696ada0f7dff280 Author: Anatol Belski <ab@php.net> Tue, 13 Sep 2016 11:50:18 +0200 Parents: 66c42fcf49ef4d38c916439e60e8d71ea39c8969 Branches: PHP-7.0.11 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=18b6f6ee016d558aafb9e7653696ada0f7dff280 Log: pick up the safe alloc pieces from 19866fb76cf4c95d904ebb0e08592cf38303fae9 (cherry picked from commit c403b3029123aefe0919058b100e80c6bc4e1a6d) 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 11b8c41..46dc8e0 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -2544,7 +2544,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)) { @@ -2653,14 +2653,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); @@ -2668,7 +2668,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 (#94484) next »