From: Ilia Alshanetsky Date: Tue, 18 Jan 2005 15:51:24 +0000 (+0000) Subject: MFH: Fixed bug #31479 (Fixed crash in chunk_split(), when chunklen > strlen). X-Git-Tag: php-4.3.11RC1~141 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aec129db7f95aea15071b2d829fe52f02ad9b116;p=php MFH: Fixed bug #31479 (Fixed crash in chunk_split(), when chunklen > strlen). --- diff --git a/NEWS b/NEWS index f442ecc92b..6d6a1be0a4 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ PHP 4 NEWS - Fixed MacOSX shared extensions crashing on Apache startup. (Rasmus) - Added Oracle Instant Client support. (cjbj at hotmail dot com, Tony) - Fixed bug #31580 (fgetcsv() problematic with "" escape sequences). (Ilia) +- 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 556da7ba51..9ee87aa874 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -1575,6 +1575,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(); }