]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
iso9660: Use memmove with overlapping memory
authorTobias Stoeckmann <tobias@stoeckmann.org>
Sun, 19 Apr 2026 19:40:19 +0000 (21:40 +0200)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Sun, 19 Apr 2026 19:40:19 +0000 (21:40 +0200)
Resolving paths like "dir/../filename" to "filename" can lead
to a strcpy call with overlapping memory. Use memmove instead,
which already happens at times in isofile_gen_utility_names.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
libarchive/archive_write_set_format_iso9660.c

index 359a2737365fe94230ba8f64636f4c4e8e721a59..3d350f5afab9b8c367135a915d7199598f2441c0 100644 (file)
@@ -4916,10 +4916,10 @@ isofile_gen_utility_names(struct archive_write *a, struct isofile *file)
                                        --rp;
                                }
                                if (rp > dirname) {
-                                       strcpy(rp, p+3);
+                                       memmove(rp, p + 3, strlen(p + 3) + 1);
                                        p = rp;
                                } else {
-                                       strcpy(dirname, p+4);
+                                       memmove(dirname, p + 4, strlen(p + 4) + 1);
                                        p = dirname;
                                }
                        } else