Merge branch 'fix-buffer-overflow-hookchangemusic' into 'next'

Fix buffer overflow when invoking MusicChange hook

See merge request STJr/SRB2!2441
This commit is contained in:
Alam Ed Arias 2024-05-08 18:06:07 +00:00
commit 488e6d5699

View file

@ -2256,9 +2256,9 @@ void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32
return; return;
strncpy(newmusic, mmusic, sizeof(newmusic)-1); strncpy(newmusic, mmusic, sizeof(newmusic)-1);
newmusic[6] = 0;
if (LUA_HookMusicChange(music_name, &hook_param)) if (LUA_HookMusicChange(music_name, &hook_param))
return; return;
newmusic[6] = 0;
// No Music (empty string) // No Music (empty string)
if (newmusic[0] == 0) if (newmusic[0] == 0)