From: Ilia Alshanetsky Date: Tue, 18 Jan 2005 15:47:57 +0000 (+0000) Subject: Fixed bug #31479 (Fixed crash in chunk_split(), when chunklen > strlen). X-Git-Tag: RELEASE_0_2~263 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1e6454a67b3a347a45d7a199173f2bb1dbf9c386;p=php Fixed bug #31479 (Fixed crash in chunk_split(), when chunklen > strlen). --- diff --git a/ext/standard/string.c b/ext/standard/string.c index 1c9ee20d69..1b8916ec0b 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -1890,6 +1890,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(); }