Fix mapmusname not overwriting Lua-provided strings

This commit is contained in:
Radicalicious 2022-08-02 20:59:13 -05:00
parent c65851d17c
commit 71caaf180c

View file

@ -441,12 +441,13 @@ int LUA_CheckGlobals(lua_State *L, const char *word)
const char *str = luaL_checklstring(L, 2, &strlength);
if (strlength > 6)
return luaL_error(L, "string length out of range (maximum 6 characters)");
LUA_UsageWarning(L, "mapmusname: Music name too long - truncated to six characters.");
if (strlen(str) < strlength)
return luaL_error(L, "string must not contain embedded zeros!");
strncpy(mapmusname, str, strlength);
strlcpy(mapmusname, str, sizeof mapmusname);
}
else if (fastcmp(word, "mapmusflags"))
mapmusflags = (UINT16)luaL_checkinteger(L, 2);