From 5a4c443c790b6c1b3f31eb6a6d3ac10222571b3e Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Tue, 20 Jun 2023 14:11:53 +0300 Subject: [PATCH] filesystem: fix regression in FS_LoadFile not skipping leading slashes Earlier it used FS_Open which handles this, but because we don't call that anymore, just skip it ourselves for compatibility. --- filesystem/filesystem.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/filesystem/filesystem.c b/filesystem/filesystem.c index 81883241..44f7af30 100644 --- a/filesystem/filesystem.c +++ b/filesystem/filesystem.c @@ -1913,7 +1913,7 @@ file_t *FS_Open( const char *filepath, const char *mode, qboolean gamedironly ) if( !fs_searchpaths ) return NULL; - // some stupid mappers used leading '/' or '\' in path to models or sounds + // some mappers used leading '/' or '\' in path to models or sounds if( filepath[0] == '/' || filepath[0] == '\\' ) filepath++; @@ -2337,6 +2337,13 @@ byte *FS_LoadFile( const char *path, fs_offset_t *filesizeptr, qboolean gamediro char netpath[MAX_SYSPATH]; int pack_ind; + // some mappers used leading '/' or '\' in path to models or sounds + if( path[0] == '/' || path[0] == '\\' ) + path++; + + if( path[0] == '/' || path[0] == '\\' ) + path++; + if( !fs_searchpaths || FS_CheckNastyPath( path )) return NULL;