ID: 35756 Updated by: [EMAIL PROTECTED] Reported By: sqchen at citiz dot net -Status: Open +Status: Bogus Bug Type: Filesystem function related Operating System: redhat 7.3 PHP Version: 5.1.1 New Comment:
ecalloc, emalloc, erealloc and friends will never return NULL. Previous Comments: ------------------------------------------------------------------------ [2005-12-21 03:39:46] sqchen at citiz dot net Description: ------------ file ext/standard/file.c line 1028 buf = ecalloc(len + 1, sizeof(char)); if (php_stream_get_line(stream, buf, len, &line_len) == NULL) { goto exit_failed; } here doesn't check the availablity of 'buf', so if ecalloc doesn't calloc a memory, it will return NULL, it will cause some problem Reproduce code: --------------- $fp=fopen("1.txt", "r"); fgets($fp, 2147483640); on some platform, when ecalloc failed, it will return NULL, so segmentation fault will prompt. the same as fread function ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=35756&edit=1