]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix max path-length metadata writing (#2243)
authorSam Bingner <sam@bingner.com>
Fri, 5 Jul 2024 19:34:43 +0000 (09:34 -1000)
committerGitHub <noreply@github.com>
Fri, 5 Jul 2024 19:34:43 +0000 (12:34 -0700)
Previous code added `.XXXXXX` to the end of the filename to write the
mac metadata. This is a problem if the filename is at or near the
filesystem max path length. This reuses the same code used by
create_tempdatafork to ensure that the filename is not too long.

libarchive/archive_write_disk_posix.c

index bac906d26d9570d652ba378b77c93c8e9d7efc3f..098a8fe4113feb5432b70c7e8e1fc98af4118985 100644 (file)
@@ -4360,8 +4360,7 @@ set_mac_metadata(struct archive_write_disk *a, const char *pathname,
         * silly dance of writing the data to disk just so that
         * copyfile() can read it back in again. */
        archive_string_init(&tmp);
-       archive_strcpy(&tmp, pathname);
-       archive_strcat(&tmp, ".XXXXXX");
+       archive_strcpy(&tmp, "tar.mmd.XXXXXX");
        fd = mkstemp(tmp.s);
 
        if (fd < 0) {