From: Sam Bingner Date: Fri, 5 Jul 2024 19:34:43 +0000 (-1000) Subject: Fix max path-length metadata writing (#2243) X-Git-Tag: v3.7.5~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e73ea3a7db1c3c743c28a0d2dd0456a43e96b96;p=thirdparty%2Flibarchive.git Fix max path-length metadata writing (#2243) 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. --- diff --git a/libarchive/archive_write_disk_posix.c b/libarchive/archive_write_disk_posix.c index bac906d26..098a8fe41 100644 --- a/libarchive/archive_write_disk_posix.c +++ b/libarchive/archive_write_disk_posix.c @@ -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) {