]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Handle truncation in the middle of a GNU long linkname (#2422)
authorTim Kientzle <kientzle@acm.org>
Tue, 10 Dec 2024 05:09:29 +0000 (21:09 -0800)
committerGitHub <noreply@github.com>
Tue, 10 Dec 2024 05:09:29 +0000 (21:09 -0800)
Thanks to gbdngb12 김동건 for reporting this.

Resolves Issue #2415

libarchive/archive_read_support_format_tar.c

index 4aaf1b90cebb4b177d8ec45c8f35366ecd876476..b1344ae57d4a1bd4d89dbaca5eab814bc308cd98 100644 (file)
@@ -1146,7 +1146,9 @@ header_gnu_longlink(struct archive_read *a, struct tar *tar,
        struct archive_string linkpath;
        archive_string_init(&linkpath);
        err = read_body_to_string(a, tar, &linkpath, h, unconsumed);
-       archive_entry_set_link(entry, linkpath.s);
+       if (err == ARCHIVE_OK) {
+               archive_entry_set_link(entry, linkpath.s);
+       }
        archive_string_free(&linkpath);
        return (err);
 }