]> granicus.if.org Git - php/commitdiff
MFH: Fixed bug #31479 (Fixed crash in chunk_split(), when chunklen > strlen).
authorIlia Alshanetsky <iliaa@php.net>
Tue, 18 Jan 2005 15:48:39 +0000 (15:48 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 18 Jan 2005 15:48:39 +0000 (15:48 +0000)
NEWS
ext/standard/string.c

diff --git a/NEWS b/NEWS
index 2c73c02905bcd5454989fba19c8bb568f6055ad6..ef01e59bf93ef7e09c0f00531ff36783f6add6f4 100644 (file)
--- 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).
index a84687f2def97e12187c5df89f842647a17fb7da..843b31b572338ea4c35438fe5a926a97deac7a0f 100644 (file)
@@ -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();
        }