diff --git a/luasocket/src/options.c b/luasocket/src/options.c index 20f4c28..668cc80 100644 --- a/luasocket/src/options.c +++ b/luasocket/src/options.c @@ -37,8 +37,8 @@ int opt_meth_setoption(lua_State *L, p_opt opt, p_socket ps) while (opt->name && strcmp(name, opt->name)) opt++; if (!opt->func) { - char msg[45]; - sprintf(msg, "unsupported option `%.35s'", name); + char msg[64]; + snprintf(msg, sizeof(msg), "unsupported option `%.35s'", name); luaL_argerror(L, 2, msg); } return opt->func(L, ps); @@ -50,8 +50,8 @@ int opt_meth_getoption(lua_State *L, p_opt opt, p_socket ps) while (opt->name && strcmp(name, opt->name)) opt++; if (!opt->func) { - char msg[45]; - sprintf(msg, "unsupported option `%.35s'", name); + char msg[64]; + snprintf(msg, sizeof(msg), "unsupported option `%.35s'", name); luaL_argerror(L, 2, msg); } return opt->func(L, ps);