@@ -4169,9 +4169,7 @@ static zend_result phar_extract_file(bool overwrite, phar_entry_info *entry, cha
4169
4169
if (virtual_file_ex (& new_state , entry -> filename , NULL , CWD_EXPAND ) != 0 ||
4170
4170
new_state .cwd_length <= 1 ) {
4171
4171
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 );
4175
4173
} else {
4176
4174
spprintf (error , 4096 , "Cannot extract \"%s\", internal error" , entry -> filename );
4177
4175
}
@@ -4196,13 +4194,10 @@ static zend_result phar_extract_file(bool overwrite, phar_entry_info *entry, cha
4196
4194
len = spprintf (& fullpath , 0 , "%s/%s" , dest , filename );
4197
4195
4198
4196
if (len >= MAXPATHLEN ) {
4199
- char * tmp ;
4200
4197
/* truncate for error message */
4201
4198
fullpath [50 ] = '\0' ;
4202
4199
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 );
4206
4201
} else {
4207
4202
spprintf (error , 4096 , "Cannot extract \"%s\" to \"%s...\", extracted filename is too long for filesystem" , entry -> filename , fullpath );
4208
4203
}
0 commit comments