summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSascha Schumann <sas@php.net>2004-08-02 08:27:24 +0000
committerSascha Schumann <sas@php.net>2004-08-02 08:27:24 +0000
commit26cb5355e05a98150cd6204aa7f79fc4ceab2c71 (patch)
tree60efb0fbd080dd39b470fdb7e98f0f8692299481
parentd746343928fc27bb5e973a8baba41441eb5ae4ac (diff)
downloadphp-git-26cb5355e05a98150cd6204aa7f79fc4ceab2c71.tar.gz
don't read empty files
0 malloc noticed by Antony Dovgal <tony2001@phpclub.net>
-rw-r--r--ext/session/mod_files.c6
1 files changed, 6 insertions, 0 deletions
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)