Skip to content

Commit

Permalink
Do not overwrite an existing WCS pathname either
Browse files Browse the repository at this point in the history
  • Loading branch information
kientzle committed Jul 8, 2024
1 parent dbadd3e commit 8d74786
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libarchive/archive_read_support_format_tar.c
Original file line number Diff line number Diff line change
Expand Up @@ -1677,7 +1677,9 @@ header_ustar(struct archive_read *a, struct tar *tar,

/* Copy name into an internal buffer to ensure null-termination. */
const char *existing_pathname = archive_entry_pathname(entry);
if (existing_pathname == NULL || existing_pathname[0] == '\0') {
const wchar_t *existing_wcs_pathname = archive_entry_pathname_w(entry);
if ((existing_pathname == NULL || existing_pathname[0] == '\0')
&& (existing_wcs_pathname == NULL || existing_wcs_pathname[0] == '\0')) {
archive_string_init(&as);
if (header->prefix[0]) {
archive_strncpy(&as, header->prefix, sizeof(header->prefix));
Expand Down

0 comments on commit 8d74786

Please sign in to comment.