]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Check WCS pathname in header_gnutar 2740/head
authorDuncan Horn <dunhor@microsoft.com>
Thu, 25 Sep 2025 23:03:18 +0000 (16:03 -0700)
committerDuncan Horn <dunhor@microsoft.com>
Thu, 25 Sep 2025 23:03:18 +0000 (16:03 -0700)
libarchive/archive_read_support_format_tar.c

index cb5344d6052616ff7ac651348b06aeb82b69ff2f..37fdd2ce7fbca2d1bebf4eb0a58d3b07a23fe216 100644 (file)
@@ -2940,7 +2940,9 @@ header_gnutar(struct archive_read *a, struct tar *tar,
        /* Copy filename over (to ensure null termination). */
        header = (const struct archive_entry_header_gnutar *)h;
        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] == L'\0')) {
                if (archive_entry_copy_pathname_l(entry,
                    header->name, sizeof(header->name), tar->sconv) != 0) {
                        err = set_conversion_failed_error(a, tar->sconv, "Pathname");