]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
[Zip] Reject overlong pathnames in Zip writer 2993/head
authorTim Kientzle <kientzle@acm.org>
Sat, 2 May 2026 23:52:35 +0000 (16:52 -0700)
committerTim Kientzle <kientzle@acm.org>
Sat, 2 May 2026 23:52:35 +0000 (16:52 -0700)
libarchive/archive_write_set_format_zip.c

index 81d3db0db0383c4f8fe71a795a86ef8648861057..78cd63f0c407794738ad7804bc5213e9e025d3b6 100644 (file)
@@ -959,6 +959,11 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry)
                }
        }
        filename_length = path_length(zip->entry);
+       if (filename_length > 0xffff) {
+               archive_set_error(&a->archive, ENAMETOOLONG,
+                   "Pathname too long for ZIP format");
+               return (ARCHIVE_FAILED);
+       }
 
        /* Determine appropriate compression and size for this entry. */
        if (type == AE_IFLNK) {