]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Merge pull request #2831 from AZero13/check-copy-length
authorTim Kientzle <kientzle@acm.org>
Sat, 27 Dec 2025 18:27:12 +0000 (10:27 -0800)
committerMartin Matuska <martin@matuska.de>
Sun, 28 Dec 2025 12:13:13 +0000 (13:13 +0100)
Use copy_length as upper-bound, not strlen(p)

(cherry picked from commit 782cdd88b6e5da4d2c023662c790837fc5f5c1af)

libarchive/archive_write_set_format_ustar.c

index 09b71fe6672a0418fd4887510a69f3b96a3de686..4084eb45596841bc363a828d5bbde04680903569 100644 (file)
@@ -539,7 +539,7 @@ __archive_write_format_header_ustar(struct archive_write *a, char h[512],
                ret = ARCHIVE_WARN;
        }
        if (copy_length > 0) {
-               if (strlen(p) > USTAR_gname_size) {
+               if (copy_length > USTAR_gname_size) {
                        if (tartype != 'x') {
                                archive_set_error(&a->archive,
                                    ARCHIVE_ERRNO_MISC, "Group name too long");