[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-cvs
Subject:    [PHP-CVS] [php-src] master: Merge branch 'PHP-8.1' into PHP-8.2
From:       George Peter Banyard <noreply () php ! net>
Date:       2023-01-29 17:30:39
Message-ID: iFkgOPmcPYElcAijSTBb1oUIh4NEd2xMUmyHp8ED0 () main ! php ! net
[Download RAW message or body]

Author: George Peter Banyard (Girgias)
Date: 2023-01-29T17:17:21Z

Commit: https://github.com/php/php-src/commit/08f654b590a66c2491d51a3ab64842166d608435
Raw diff: https://github.com/php/php-src/commit/08f654b590a66c2491d51a3ab64842166d608435.diff

Merge branch 'PHP-8.1' into PHP-8.2

* PHP-8.1:
  Fix incorrect check in phar tar parsing

Changed paths:
  M  NEWS
  M  ext/phar/tar.c


Diff:

diff --git a/NEWS b/NEWS
index 6fbe29aae41e..cd40429f3d48 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,9 @@ PHP                                                                        NEWS
 - Opcache:
   . Fix incorrect page_size check. (nielsdos)
 
+- Phar:
+  . Fix incorrect check in phar tar parsing. (nielsdos)
+
 - Random:
   . Fix GH-10390 (Do not trust arc4random_buf() on glibc). (timwolla)
   . Fix GH-10292 (Made the default value of the first param of srand() and
diff --git a/ext/phar/tar.c b/ext/phar/tar.c
index 3b2e4c2ca76a..1edc00834499 100644
--- a/ext/phar/tar.c
+++ b/ext/phar/tar.c
@@ -478,14 +478,15 @@ int phar_parse_tarfile(php_stream* fp, char *fname, size_t fname_len, char *alia
 			return FAILURE;
 		}
 
+		uint32_t entry_mode = phar_tar_number(hdr->mode, sizeof(hdr->mode));
 		entry.tar_type = ((old & (hdr->typeflag == '\0')) ? TAR_FILE : hdr->typeflag);
 		entry.offset = entry.offset_abs = pos; /* header_offset unused in tar */
 		entry.fp_type = PHAR_FP;
-		entry.flags = phar_tar_number(hdr->mode, sizeof(hdr->mode)) & PHAR_ENT_PERM_MASK;
+		entry.flags = entry_mode & PHAR_ENT_PERM_MASK;
 		entry.timestamp = phar_tar_number(hdr->mtime, sizeof(hdr->mtime));
 		entry.is_persistent = myphar->is_persistent;
 
-		if (old && entry.tar_type == TAR_FILE && S_ISDIR(entry.flags)) {
+		if (old && entry.tar_type == TAR_FILE && S_ISDIR(entry_mode)) {
 			entry.tar_type = TAR_DIR;
 		}
 

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic