php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #71966
Patch php-dotslash.patch revision 2016-04-05 13:10 UTC by pandrade at redhat dot com

Patch php-dotslash.patch for PHAR related Bug #71966

Patch version 2016-04-05 13:10 UTC

Return to Bug #71966 | Download this patch
Patch Revisions:

Developer: pandrade@redhat.com

diff -up php-5.4.16/ext/phar/tar.c.orig php-5.4.16/ext/phar/tar.c
--- php-5.4.16/ext/phar/tar.c.orig	2016-03-29 11:39:57.020599910 -0300
+++ php-5.4.16/ext/phar/tar.c	2016-03-29 11:42:25.582624697 -0300
@@ -481,6 +481,9 @@ bail:
 			entry.link = estrdup(hdr->linkname);
 		}
 		phar_set_inode(&entry TSRMLS_CC);
+		if (entry.filename_len > 2 && entry.filename[0] == '.' && entry.filename[1] == '/')
+			/* Also copy trailing nul */
+			memmove(entry.filename, entry.filename + 2, (entry.filename_len -= 2) + 1);
 		zend_hash_add(&myphar->manifest, entry.filename, entry.filename_len, (void*)&entry, sizeof(phar_entry_info), (void **) &newentry);
 
 		if (entry.is_persistent) {
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Jun 25 05:01:24 2021 UTC