From c0832b91d33daf210d4ccbb5da0cfb4c25e5d993 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sat, 12 Oct 2024 01:47:52 +0200 Subject: [PATCH] SDL: fix buffer overrun in SDL_strncmp Always check len first before dereferencing the pointers. --- src/thirdparty/sdl/src/stdlib/SDL_string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thirdparty/sdl/src/stdlib/SDL_string.c b/src/thirdparty/sdl/src/stdlib/SDL_string.c index 12cc2da8..aec3417b 100644 --- a/src/thirdparty/sdl/src/stdlib/SDL_string.c +++ b/src/thirdparty/sdl/src/stdlib/SDL_string.c @@ -1086,7 +1086,7 @@ SDL_strncmp(const char *str1, const char *str2, size_t maxlen) #if defined(HAVE_STRNCMP) return strncmp(str1, str2, maxlen); #else - while (*str1 && *str2 && maxlen) { + while (maxlen && *str1 && *str2) { if (*str1 != *str2) break; ++str1;