Commit:    523bf03cd8e66fd345cddd56df73c31af7bf9186
Author:    Stanislav Malyshev <s...@php.net>         Mon, 28 May 2012 18:54:15 
-0700
Parents:   9b3358599f587f529d584d2388fe3ef42742c768
Branches:  PHP-5.4.4

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=523bf03cd8e66fd345cddd56df73c31af7bf9186

Log:
fix unchecked emalloc

Changed paths:
  M  ext/phar/tar.c


Diff:
diff --git a/ext/phar/tar.c b/ext/phar/tar.c
index b914db1..917734c 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) {


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to