@@ -4169,9 +4169,7 @@ static zend_result phar_extract_file(bool overwrite, phar_entry_info *entry, cha
41694169 if (virtual_file_ex (& new_state , entry -> filename , NULL , CWD_EXPAND ) != 0 ||
41704170 new_state .cwd_length <= 1 ) {
41714171 if (EINVAL == errno && entry -> filename_len > 50 ) {
4172- char * tmp = estrndup (entry -> filename , 50 );
4173- spprintf (error , 4096 , "Cannot extract \"%s...\" to \"%s...\", extracted filename is too long for filesystem" , tmp , dest );
4174- efree (tmp );
4172+ spprintf (error , 4096 , "Cannot extract \"%.50s...\" to \"%s...\", extracted filename is too long for filesystem" , entry -> filename , dest );
41754173 } else {
41764174 spprintf (error , 4096 , "Cannot extract \"%s\", internal error" , entry -> filename );
41774175 }
@@ -4196,13 +4194,10 @@ static zend_result phar_extract_file(bool overwrite, phar_entry_info *entry, cha
41964194 len = spprintf (& fullpath , 0 , "%s/%s" , dest , filename );
41974195
41984196 if (len >= MAXPATHLEN ) {
4199- char * tmp ;
42004197 /* truncate for error message */
42014198 fullpath [50 ] = '\0' ;
42024199 if (entry -> filename_len > 50 ) {
4203- tmp = estrndup (entry -> filename , 50 );
4204- spprintf (error , 4096 , "Cannot extract \"%s...\" to \"%s...\", extracted filename is too long for filesystem" , tmp , fullpath );
4205- efree (tmp );
4200+ spprintf (error , 4096 , "Cannot extract \"%.50s...\" to \"%s...\", extracted filename is too long for filesystem" , entry -> filename , fullpath );
42064201 } else {
42074202 spprintf (error , 4096 , "Cannot extract \"%s\" to \"%s...\", extracted filename is too long for filesystem" , entry -> filename , fullpath );
42084203 }
0 commit comments