From 397d7f21b4d0edefceba4c604ab0b2005e89f811 Mon Sep 17 00:00:00 2001 From: Misa Date: Sun, 19 Mar 2023 14:00:34 -0700 Subject: [PATCH] Add length check to OGG check Dav999 pointed out this potential issue on Discord. While basically all memcmp implementations will terminate early here if there's a null byte (because it's mismatched), it doesn't hurt to add the check here. --- desktop_version/src/Music.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop_version/src/Music.cpp b/desktop_version/src/Music.cpp index 7eeac745..8f2b6e47 100644 --- a/desktop_version/src/Music.cpp +++ b/desktop_version/src/Music.cpp @@ -107,7 +107,7 @@ public: } SDL_zerop(this); - if (SDL_memcmp(mem, "OggS", 4) == 0) + if (length >= 4 && SDL_memcmp(mem, "OggS", 4) == 0) { LoadOGG(fileName, mem, length); }