]> granicus.if.org Git - php/commitdiff
MFH
authorIlia Alshanetsky <iliaa@php.net>
Wed, 2 Apr 2003 00:25:57 +0000 (00:25 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 2 Apr 2003 00:25:57 +0000 (00:25 +0000)
ext/standard/string.c

index db6ca361ffcc93624f72affbc8dccc82989993ec..6e2379a232550706a22bf367b91a317975e7b721 100644 (file)
@@ -3531,6 +3531,10 @@ PHP_FUNCTION(str_repeat)
        
        /* Initialize the result string */      
        result_len = Z_STRLEN_PP(input_str) * Z_LVAL_PP(mult);
+       if (result_len < 1 || result_len > 2147483647) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "You may not create strings longer then 2147483647 bytes");
+               RETURN_FALSE;
+       }
        result = (char *)emalloc(result_len + 1);
        
        /* Heavy optimization for situations where input string is 1 byte long */