summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2012-05-28 18:54:15 -0700
committerJohannes Schlüter <johannes@php.net>2012-05-30 21:39:01 +0200
commite9e4819c1b7396c4ee1120685aadae84396ac820 (patch)
tree3e972770da6a19f418ffe58c240ad74a1278ba6a
parent438e03a354996506833287e56443ca4fe5c38726 (diff)
downloadphp-git-e9e4819c1b7396c4ee1120685aadae84396ac820.tar.gz
fix unchecked emalloc
(cherry picked from commit 158d8a6b088662ce9d31e0c777c6ebe90efdc854) (cherry picked from commit fa05f038cb2cd9e9fa17efd2286c42dcb3e9aa05)
-rw-r--r--ext/phar/tar.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/phar/tar.c b/ext/phar/tar.c
index b914db129e..917734c992 100644
--- a/ext/phar/tar.c
+++ b/ext/phar/tar.c
@@ -38,7 +38,7 @@ static php_uint32 phar_tar_number(char *buf, int len) /* {{{ */
/* }}} */
/* adapted from format_octal() in libarchive
- *
+ *
* Copyright (c) 2003-2009 Tim Kientzle
* All rights reserved.
*
@@ -161,7 +161,7 @@ static int phar_tar_process_metadata(phar_entry_info *entry, php_stream *fp TSRM
size_t save = php_stream_tell(fp), read;
phar_entry_info *mentry;
- metadata = (char *) emalloc(entry->uncompressed_filesize + 1);
+ metadata = (char *) safe_emalloc(1, entry->uncompressed_filesize, 1);
read = php_stream_read(fp, metadata, entry->uncompressed_filesize);
if (read != entry->uncompressed_filesize) {
@@ -377,7 +377,7 @@ bail:
}
read = php_stream_read(fp, buf, sizeof(buf));
-
+
if (read != sizeof(buf)) {
efree(entry.filename);
if (error) {