Skip to content

Commit

Permalink
Read 7zip symlink names as UTF-8
Browse files Browse the repository at this point in the history
  • Loading branch information
dunhor committed Jun 11, 2024
1 parent ffa43ae commit a11b570
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions libarchive/archive_read_support_format_7zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -835,9 +835,20 @@ archive_read_format_7zip_read_header(struct archive_read *a,
zip_entry->mode |= AE_IFREG;
archive_entry_set_mode(entry, zip_entry->mode);
} else {
struct archive_string_conv* utf8_conv;

symname[symsize] = '\0';
archive_entry_copy_symlink(entry,
(const char *)symname);

/* Symbolic links are embedded as UTF-8 strings */
utf8_conv = archive_string_conversion_from_charset(&a->archive,
"UTF-8", 1);
if (utf8_conv == NULL) {
free(symname);
return ARCHIVE_FATAL;
}

archive_entry_copy_symlink_l(entry, (const char*)symname, symsize,
utf8_conv);
}
free(symname);
archive_entry_set_size(entry, 0);
Expand Down

0 comments on commit a11b570

Please sign in to comment.