]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Merge pull request #2813 from AZero13/memcpy
authorMartin Matuška <martin@matuska.de>
Fri, 26 Dec 2025 09:22:13 +0000 (10:22 +0100)
committerMartin Matuska <martin@matuska.de>
Fri, 26 Dec 2025 09:23:58 +0000 (10:23 +0100)
We copy from p, not p + module_len

(cherry picked from commit b2d68e2f1a24594fbf8e79096ca18ece309497b0)

tar/write.c

index 4369bce7fa09c641f94d7796bf666d207b05ba01..b39a397707ba14c1e9140b8317cc749e4ef6fe71 100644 (file)
@@ -163,7 +163,7 @@ set_writer_options(struct bsdtar *bsdtar, struct archive *a)
                 * a format or filters which are not added to
                 * the archive write object. */
                memcpy(p, IGNORE_WRONG_MODULE_NAME, module_len);
-               memcpy(p, writer_options, opt_len);
+               memcpy(p + module_len, writer_options, opt_len);
                r = archive_write_set_options(a, p);
                free(p);
                if (r < ARCHIVE_WARN)
@@ -195,7 +195,7 @@ set_reader_options(struct bsdtar *bsdtar, struct archive *a)
                 * a format or filters which are not added to
                 * the archive write object. */
                memcpy(p, IGNORE_WRONG_MODULE_NAME, module_len);
-               memcpy(p, reader_options, opt_len);
+               memcpy(p + module_len, reader_options, opt_len);
                r = archive_read_set_options(a, p);
                free(p);
                if (r < ARCHIVE_WARN)