summaryrefslogtreecommitdiff
path: root/ext/fdf/fdf.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2004-11-08 04:54:27 +0000
committerIlia Alshanetsky <iliaa@php.net>2004-11-08 04:54:27 +0000
commitcb16f5e815333a2e5e277820aa223b94bec7cf65 (patch)
tree0bd5f4cd1c66f9e4ca78b6e51003c2a68c518b02 /ext/fdf/fdf.c
parent890afc455c703958f9dab483936b8f3b30b81287 (diff)
downloadphp-git-cb16f5e815333a2e5e277820aa223b94bec7cf65.tar.gz
Fixed possible crash on fstat() failure.
Diffstat (limited to 'ext/fdf/fdf.c')
-rw-r--r--ext/fdf/fdf.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/fdf/fdf.c b/ext/fdf/fdf.c
index e3568b199a..db3a88e6d7 100644
--- a/ext/fdf/fdf.c
+++ b/ext/fdf/fdf.c
@@ -871,7 +871,10 @@ PHP_FUNCTION(fdf_save_string)
struct stat stat;
char *buf;
- fstat(fileno(fp), &stat);
+ if (fstat(fileno(fp), &stat) == -1) {
+ RETVAL_FALSE;
+ goto err;
+ }
buf = emalloc(stat.st_size +1);
fread(buf, stat.st_size, 1, fp);
buf[stat.st_size] = '\0';
@@ -889,7 +892,7 @@ PHP_FUNCTION(fdf_save_string)
if(err != FDFErcOK) {
FDF_FAILURE(err);
}
-
+err:
if(temp_filename) {
unlink(temp_filename);
efree(temp_filename);