summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Joye <pierre.php@gmail.com>2013-05-14 09:20:53 +0200
committerPierre Joye <pierre.php@gmail.com>2013-05-14 09:20:53 +0200
commit533e636a62a1f1d5119f262f44c48097d7762735 (patch)
treeb15b89908906c2a4310222b7dbb5f9c671f7aaca
parentfe21accfb4913bf309f26894ae27e9ad34fb5260 (diff)
downloadphp-git-533e636a62a1f1d5119f262f44c48097d7762735.tar.gz
php_stream_fopen_tmpfile may file, causing any following stream usage to crash
-rw-r--r--ext/phar/zip.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/phar/zip.c b/ext/phar/zip.c
index 33732fbd63..2d57c08c5a 100644
--- a/ext/phar/zip.c
+++ b/ext/phar/zip.c
@@ -1122,6 +1122,10 @@ static int phar_zip_applysignature(phar_archive_data *phar, struct _phar_zip_pas
entry.fp = php_stream_fopen_tmpfile();
entry.fp_type = PHAR_MOD;
entry.is_modified = 1;
+ if (entry.fp == NULL) {
+ spprintf(pass->error, 0, "phar error: unable to create temporary file for signature");
+ return FAILURE;
+ }
PHAR_SET_32(sigbuf, phar->sig_flags);
PHAR_SET_32(sigbuf + 4, signature_length);