From: Tobias Stoeckmann Date: Sun, 19 Apr 2026 20:10:10 +0000 (+0200) Subject: iso9660: Fix ../../ path normalization X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=941e32fd6e37ab7e2441605eebdcd04b9616d60d;p=thirdparty%2Flibarchive.git iso9660: Fix ../../ path normalization The function isofile_gen_utility_names could resolve .. directory entries in a way that dirname will start with "../". If this happens, the while-loop is unable to detect this because it forwards until the cursor detects a slash again. Fix this by also taking "../" at the beginning into account. Such an entry can happen if "../../" points before the top directory. Signed-off-by: Tobias Stoeckmann --- diff --git a/libarchive/archive_write_set_format_iso9660.c b/libarchive/archive_write_set_format_iso9660.c index 4df9d12a2..1e293588b 100644 --- a/libarchive/archive_write_set_format_iso9660.c +++ b/libarchive/archive_write_set_format_iso9660.c @@ -4927,6 +4927,12 @@ isofile_gen_utility_names(struct archive_write *a, struct isofile *file) } } else p++; + } else if (p == dirname && p[0] == '.' && p[1] == '.' && p[2] == '/') { + size_t off; + for (off = 3; p[off] == '/'; off++) + ; + memmove(dirname, p + off, strlen(p + off) + 1); + p = dirname; } else p++; }