File tree Expand file tree Collapse file tree 4 files changed +27
-3
lines changed Expand file tree Collapse file tree 4 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -40,8 +40,10 @@ PHP NEWS
40
40
. Add a check for RAND_egd to allow compiling against LibreSSL (Leigh)
41
41
42
42
- Phar:
43
- . Fixed bug 64343 (PharData::extractTo fails for tarball created by BSD tar).
43
+ . Fixed bug # 64343 (PharData::extractTo fails for tarball created by BSD tar).
44
44
(Mike)
45
+ . Fixed bug #67761 (Phar::mapPhar fails for Phars inside a path containing
46
+ ".tar"). (Mike)
45
47
46
48
- Postgres:
47
49
. Fixed bug #68741 (Null pointer dereference) (CVE-2015-1352). (Laruence)
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ int phar_is_tar(char *buf, char *fname) /* {{{ */
102
102
tar_header * header = (tar_header * ) buf ;
103
103
php_uint32 checksum = phar_tar_number (header -> checksum , sizeof (header -> checksum ));
104
104
php_uint32 ret ;
105
- char save [sizeof (header -> checksum )];
105
+ char save [sizeof (header -> checksum )], * bname ;
106
106
107
107
/* assume that the first filename in a tar won't begin with <?php */
108
108
if (!strncmp (buf , "<?php" , sizeof ("<?php" )- 1 )) {
@@ -113,7 +113,10 @@ int phar_is_tar(char *buf, char *fname) /* {{{ */
113
113
memset (header -> checksum , ' ' , sizeof (header -> checksum ));
114
114
ret = (checksum == phar_tar_checksum (buf , 512 ));
115
115
memcpy (header -> checksum , save , sizeof (header -> checksum ));
116
- if (!ret && strstr (fname , ".tar" )) {
116
+ if ((bname = strrchr (fname , PHP_DIR_SEPARATOR ))) {
117
+ fname = bname ;
118
+ }
119
+ if (!ret && (bname = strstr (fname , ".tar" )) && (bname [4 ] == '\0' || bname [4 ] == '.' )) {
117
120
/* probably a corrupted tar - so we will pretend it is one */
118
121
return 1 ;
119
122
}
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #67761 (Phar::mapPhar fails for Phars inside a path containing ".tar")
3
+ --SKIPIF--
4
+ <?php extension_loaded ("phar " ) or die ("SKIP need ext/phar suppport " ); ?>
5
+ --FILE--
6
+ <?php
7
+
8
+ echo "Test \n" ;
9
+
10
+ include __DIR__ ."/files/bug67761.tar/bug67761.phar " ;
11
+
12
+ ?>
13
+
14
+ ===DONE===
15
+ --EXPECT--
16
+ Test
17
+ #!/usr/bin/env php
18
+ Test
19
+ ===DONE===
You can’t perform that action at this time.
0 commit comments