From 15bf00e5ba35b725dccf273a690497c047b03765 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Wed, 8 May 2024 19:56:03 +0200 Subject: [PATCH] Fix buffer overflow when invoking MusicChange hook --- src/s_sound.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s_sound.c b/src/s_sound.c index 5155b90e8..32353a59c 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2256,9 +2256,9 @@ void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32 return; strncpy(newmusic, mmusic, sizeof(newmusic)-1); + newmusic[6] = 0; if (LUA_HookMusicChange(music_name, &hook_param)) return; - newmusic[6] = 0; // No Music (empty string) if (newmusic[0] == 0)