File php5-CVE-2020-7063.patch of Package php5
Index: php-5.6.40/ext/phar/phar_object.c
===================================================================
--- php-5.6.40.orig/ext/phar/phar_object.c 2019-01-09 10:54:13.000000000 +0100
+++ php-5.6.40/ext/phar/phar_object.c 2020-03-02 17:04:32.495857198 +0100
@@ -1427,6 +1427,7 @@ static int phar_build(zend_object_iterat
zend_class_entry *ce = p_obj->c;
phar_archive_object *phar_obj = p_obj->p;
char *str = "[stream]";
+ php_stream_statbuf ssb;
iter->funcs->get_current_data(iter, &value TSRMLS_CC);
@@ -1709,6 +1710,9 @@ after_open_fp:
php_stream_copy_to_stream_ex(fp, p_obj->fp, PHP_STREAM_COPY_ALL, &contents_len);
data->internal_file->uncompressed_filesize = data->internal_file->compressed_filesize =
php_stream_tell(p_obj->fp) - data->internal_file->offset;
+ if (php_stream_stat(fp, &ssb) != -1) {
+ data->internal_file->flags = ssb.sb.st_mode & PHAR_ENT_PERM_MASK ;
+ }
}
if (close_fp) {