From: Ilia Alshanetsky Date: Tue, 18 Jan 2005 15:48:39 +0000 (+0000) Subject: MFH: Fixed bug #31479 (Fixed crash in chunk_split(), when chunklen > strlen). X-Git-Tag: php-5.0.4RC1~316 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3c8424457d33a03a2a601410d69695b1dd02d17a;p=php MFH: Fixed bug #31479 (Fixed crash in chunk_split(), when chunklen > strlen). --- diff --git a/NEWS b/NEWS index 2c73c02905..ef01e59bf9 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ PHP NEWS - Added Oracle Instant Client support. (cjbj at hotmail dot com, Tony) - Added length and charsetnr for field array and object in mysqli. (Georg) - Fixed a bug in mysqli_stmt_execute() (type conversion with NULL values). (Georg) +- Fixed bug #31479 (Fixed crash in chunk_split(), when chunklen > strlen). (Ilia) - Fixed bug #31454 (session_set_save_handler crashes PHP when supplied non-existent object ref). (Tony) - Fixed bug #31444 (Memory leak in zend_language_scanner.c). diff --git a/ext/standard/string.c b/ext/standard/string.c index a84687f2de..843b31b572 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -1838,6 +1838,10 @@ PHP_FUNCTION(chunk_split) RETURN_FALSE; } + if (chunklen > Z_STRLEN_PP(p_str)) { + RETURN_STRINGL(Z_STRVAL_PP(p_str), Z_STRLEN_PP(p_str), 1); + } + if (!Z_STRLEN_PP(p_str)) { RETURN_EMPTY_STRING(); }