From 1d1470f042c37733609e4a9ef0e1c64d36566e6a Mon Sep 17 00:00:00 2001 From: bjorn Date: Thu, 9 Mar 2023 21:26:18 -0800 Subject: [PATCH] Fix directory archive path normalization; Fixes non-normalized paths not behaving as expected. --- src/modules/filesystem/filesystem.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/modules/filesystem/filesystem.c b/src/modules/filesystem/filesystem.c index 3073e292..3a88e5aa 100644 --- a/src/modules/filesystem/filesystem.c +++ b/src/modules/filesystem/filesystem.c @@ -447,13 +447,14 @@ enum { PATH_PHYSICAL }; -static int dir_resolve(Archive* archive, char* buffer, const char* path) { +static int dir_resolve(Archive* archive, char* buffer, const char* rawpath) { char normalized[LOVR_PATH_MAX]; + char* path = normalized; // Normalize the path - size_t length = strlen(path); + size_t length = strlen(rawpath); if (length >= sizeof(normalized)) return PATH_INVALID; - length = normalize(normalized, path, length); + length = normalize(normalized, rawpath, length); // Compare each component of normalized path and mountpoint if (archive->mountpointLength > 0) {