Merge pull request #3142 from datauwu/tar-avoid-wcs-slash-check

tar: avoid wide pathname conversion for trailing slash check
(cherry picked from commit d3d511ca9e)
This commit is contained in:
Dustin L. Howett authored and Martin Matuska committed 2026-06-23 11:05:53 +02:00
1 parent 0739756be8
commit 3f6d7526d7
1 file changed
+6 -6
+6 -6
View File
@@ -615,16 +615,16 @@ archive_read_format_tar_read_header(struct archive_read *a,
* directory: This is needed for certain old tar
* variants and even for some broken newer ones.
*/
if ((wp = archive_entry_pathname_w(entry)) != NULL) {
l = wcslen(wp);
if (l > 0 && wp[l - 1] == L'/') {
if ((p = archive_entry_pathname(entry)) != NULL) {
l = strlen(p);
if (l > 0 && p[l - 1] == '/') {
archive_entry_set_filetype(entry, AE_IFDIR);
tar->entry_bytes_remaining = 0;
tar->entry_padding = 0;
}
} else if ((p = archive_entry_pathname(entry)) != NULL) {
l = strlen(p);
if (l > 0 && p[l - 1] == '/') {
} else if ((wp = archive_entry_pathname_w(entry)) != NULL) {
l = wcslen(wp);
if (l > 0 && wp[l - 1] == L'/') {
archive_entry_set_filetype(entry, AE_IFDIR);
tar->entry_bytes_remaining = 0;
tar->entry_padding = 0;