]> granicus.if.org Git - php/commitdiff
don't read empty files
authorSascha Schumann <sas@php.net>
Mon, 2 Aug 2004 08:27:24 +0000 (08:27 +0000)
committerSascha Schumann <sas@php.net>
Mon, 2 Aug 2004 08:27:24 +0000 (08:27 +0000)
0 malloc noticed by Antony Dovgal <tony2001@phpclub.net>

ext/session/mod_files.c

index 15cd5d77475ea63288dce09a668b3dbb66411a4a..adcb476f6ef2c9a12b2167f854fb7165206379c3 100644 (file)
@@ -320,6 +320,12 @@ PS_READ_FUNC(files)
                return FAILURE;
        
        data->st_size = *vallen = sbuf.st_size;
+       
+       if (sbuf.st_size == 0) {
+               *val = STR_EMPTY_ALLOC();
+               return SUCCESS;
+       }
+       
        *val = emalloc(sbuf.st_size);
 
 #if defined(HAVE_PREAD)