From: Sascha Schumann Date: Mon, 2 Aug 2004 08:27:24 +0000 (+0000) Subject: don't read empty files X-Git-Tag: PRE_ZEND_VM_DISPATCH_PATCH~280 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=26cb5355e05a98150cd6204aa7f79fc4ceab2c71;p=php don't read empty files 0 malloc noticed by Antony Dovgal --- diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c index 15cd5d7747..adcb476f6e 100644 --- a/ext/session/mod_files.c +++ b/ext/session/mod_files.c @@ -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)