Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.5

Bug #10144 long filenames are not stored correctly
Submitted: 2007-02-21 14:31 UTC
From: fritsch+pear dot php dot net at in dot tum dot de Assigned: cbrunet
Status: Verified Package: File_Archive (version 1.5.3)
PHP Version: Irrelevant OS: Ubuntu
Roadmaps: 1.5.5    
Subscription  
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes. If this is not your bug, you can add a comment by following this link. If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
2010-09-06 19:05 UTC
Package:
Bug Type:
Summary:
From: fritsch+pear dot php dot net at in dot tum dot de
New email:
PHP Version: Package Version: OS:

 

 [2007-02-21 14:31 UTC] fritsch+pear dot php dot net at in dot tum dot de (Hagen Fritsch)
Description: ------------ In Writer/Tar.php it reads like this: $filePrefix = ''; if (strlen($filename) > 255) { return PEAR::raiseError( "$filename is too long to be put in a tar archive" ); } else if (strlen($filename) > 100) { $filePrefix = substr($filename, 0, strlen($filename)-100); $filename = substr($filename, -100); } Actually (at least unix tar handles archives like that) the prefix needs to be a path-component, so that "$filePrefix/$filename" is the actual filename. This is not handled correctly by the above code, so it will inject a slash at strlen()-100 for the filename, resulting in really messy tarfiles. Test script: --------------- A solution might look like this: } else if (strlen($filename) > 100) { #need a path component of max 155 bytes $pos = strrpos(substr($filename, 0, 155), '/'); if(strlen($filename) - $pos > 100) #filename-component may not exceed 100 bytes return PEAR::raiseError( "$filename is too long to be put in a tar archive" ); $filePrefix = substr($filename, 0, $pos); $filename = substr($filename, $pos+1); echo "$filePrefix vs $filename<br>\n"; }

Comments

 [2008-06-04 19:15 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2010-09-06 19:05 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!