From 1f019ed27772b65768abc2c1d87bdc786d2a0dd2 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 24 Mar 2024 15:25:08 +0100 Subject: [PATCH 1/2] Don't traverse the entire HOME directory to find wads https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2396 --- src/sdl/i_system.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index bea0f645b..3524a6f06 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -4039,12 +4039,16 @@ static const char *locateWad(void) #endif #ifndef NOHOME // find in $HOME - I_OutputMsg(",HOME"); + I_OutputMsg(",HOME/" DEFAULTDIR); if ((envstr = I_GetEnv("HOME")) != NULL) { + char *tmp = malloc(strlen(envstr) + sizeof(DEFAULTDIR)); + strcpy(tmp, envstr); + strcat(tmp, DEFAULTDIR); WadPath = searchWad(envstr); if (WadPath) return WadPath; + free(tmp); } #endif #ifdef DEFAULTSEARCHPATH1 From 850a12684727f62047f14f7932b0ee497e6f0035 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 24 Mar 2024 15:25:51 +0100 Subject: [PATCH 2/2] Fix buffer overflow when loading addons through symlinks https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2402 --- src/sdl/i_system.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 3524a6f06..48e513afc 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -3918,7 +3918,7 @@ static void pathonly(char *s) */ static const char *searchWad(const char *searchDir) { - static char tempsw[256] = ""; + static char tempsw[MAX_WADPATH] = ""; filestatus_t fstemp; strcpy(tempsw, WADKEYWORD1);