Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80565 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24299 invoked from network); 15 Jan 2015 16:32:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jan 2015 16:32:07 -0000 Authentication-Results: pb1.pair.com header.from=git@internot.info; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=git@internot.info; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain internot.info designates 185.57.82.47 as permitted sender) X-PHP-List-Original-Sender: git@internot.info X-Host-Fingerprint: 185.57.82.47 mail.internot.info Received: from [185.57.82.47] ([185.57.82.47:48938] helo=mail.internot.info) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 09/04-14306-68BE7B45 for ; Thu, 15 Jan 2015 11:32:06 -0500 To: internals@lists.php.net Cc: Joshua Rogers Date: Fri, 16 Jan 2015 03:31:51 +1100 Message-ID: <1421339511-9078-1-git-send-email-git@internot.info> Subject: [PATCH] Fixed bug #68839 Possible null pointer dereference From: git@internot.info (Joshua Rogers) --- ext/phar/zip.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ext/phar/zip.c b/ext/phar/zip.c index 2a95580..2117b0e 100644 --- a/ext/phar/zip.c +++ b/ext/phar/zip.c @@ -1217,7 +1217,9 @@ int phar_zip_flush(phar_archive_data *phar, char *user_stub, zend_long len, int if (!phar->is_temporary_alias && phar->alias_len) { entry.fp = php_stream_fopen_tmpfile(); if (entry.fp == NULL) { - spprintf(error, 0, "phar error: unable to create temporary file"); + if (error) { + spprintf(error, 0, "phar error: unable to create temporary file"); + } return EOF; } if (phar->alias_len != (int)php_stream_write(entry.fp, phar->alias, phar->alias_len)) { @@ -1309,7 +1311,9 @@ int phar_zip_flush(phar_archive_data *phar, char *user_stub, zend_long len, int len = pos - user_stub + 18; entry.fp = php_stream_fopen_tmpfile(); if (entry.fp == NULL) { - spprintf(error, 0, "phar error: unable to create temporary file"); + if (error) { + spprintf(error, 0, "phar error: unable to create temporary file"); + } return EOF; } entry.uncompressed_filesize = len + 5; @@ -1346,7 +1350,9 @@ int phar_zip_flush(phar_archive_data *phar, char *user_stub, zend_long len, int /* Either this is a brand new phar (add the stub), or the default stub is required (overwrite the stub) */ entry.fp = php_stream_fopen_tmpfile(); if (entry.fp == NULL) { - spprintf(error, 0, "phar error: unable to create temporary file"); + if (error) { + spprintf(error, 0, "phar error: unable to create temporary file"); + } return EOF; } if (sizeof(newstub)-1 != php_stream_write(entry.fp, newstub, sizeof(newstub)-1)) { -- 1.9.1