Fix directory archive path normalization;

Fixes non-normalized paths not behaving as expected.
This commit is contained in:
bjorn 2023-03-09 21:26:18 -08:00
parent b33cc99374
commit 1d1470f042
1 changed files with 4 additions and 3 deletions

View File

@ -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) {