Merge branch 'checkbotname' into 'next'

Fix #732

Closes #732

See merge request STJr/SRB2!1739
This commit is contained in:
sphere 2022-02-17 12:26:22 +00:00
commit a8c2c4ebe6

View file

@ -3486,7 +3486,7 @@ static int lib_gAddPlayer(lua_State *L)
// Read the bot name, if given // Read the bot name, if given
if (!lua_isnoneornil(L, 3)) if (!lua_isnoneornil(L, 3))
strcpy(player_names[newplayernum], luaL_checkstring(L, 3)); strlcpy(player_names[newplayernum], luaL_checkstring(L, 3), sizeof(*player_names));
bot = luaL_optinteger(L, 4, 3); bot = luaL_optinteger(L, 4, 3);
newplayer->bot = (bot >= BOT_NONE && bot <= BOT_MPAI) ? bot : BOT_MPAI; newplayer->bot = (bot >= BOT_NONE && bot <= BOT_MPAI) ? bot : BOT_MPAI;