Merge branch '4561_tar_segfault'

* 4561_tar_segfault:
  Ticket #4561: tar: fix segault on copy fiiles from archive.
This commit is contained in:
Andrew Borodin 2024-07-15 21:42:21 +03:00
commit 9f4e88fd70
1 changed files with 3 additions and 1 deletions

View File

@ -773,7 +773,6 @@ tar_read_header (struct vfs_class *me, struct vfs_s_super *archive)
} }
tar_assign_string_dup (&current_stat_info.orig_file_name, file_name); tar_assign_string_dup (&current_stat_info.orig_file_name, file_name);
canonicalize_pathname (file_name);
tar_assign_string (&current_stat_info.file_name, file_name); tar_assign_string (&current_stat_info.file_name, file_name);
g_free (recent_long_link); g_free (recent_long_link);
@ -817,6 +816,9 @@ tar_read_header (struct vfs_class *me, struct vfs_s_super *archive)
current_stat_info.is_dumpdir = TRUE; current_stat_info.is_dumpdir = TRUE;
} }
/* Do this after decoding of all headers occupied with long file/directory name. */
canonicalize_pathname (current_stat_info.file_name);
status = tar_insert_entry (me, archive, header, &inode); status = tar_insert_entry (me, archive, header, &inode);
if (status != HEADER_SUCCESS) if (status != HEADER_SUCCESS)
{ {