Use strlcpy over strcpy in cl.parseopts

This commit is contained in:
Jeremy Baxter 2023-06-27 12:43:27 +12:00
parent 2cb636f59d
commit 94f9ca6a6e

2
lcl.c
View file

@ -230,7 +230,7 @@ cl_parseopts(lua_State *L)
/* parameter type checking */
luaL_checktype(L, 1, LUA_TTABLE);
strcpy(optstring, (char *)luaL_checkstring(L, 2));
strlcpy(optstring, (char *)luaL_checkstring(L, 2), lua_rawlen(L, 2) * sizeof(char *));
luaL_checktype(L, 3, LUA_TFUNCTION);
argc = (int)lua_rawlen(L, 1) + 1; /* get argv length */