diff --git a/src/hlua.c b/src/hlua.c index 8bc831944..f99bdf9d2 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -741,6 +741,8 @@ __LJMP int hlua_lua2arg_check(lua_State *L, int first, struct arg *argp, break; case ARGT_IPV4: + if (argp[idx].type != ARGT_STR) + WILL_LJMP(luaL_argerror(L, first + idx, "string expected")); memcpy(trash.area, argp[idx].data.str.area, argp[idx].data.str.data); trash.area[argp[idx].data.str.data] = 0; @@ -759,6 +761,8 @@ __LJMP int hlua_lua2arg_check(lua_State *L, int first, struct arg *argp, break; case ARGT_IPV6: + if (argp[idx].type != ARGT_STR) + WILL_LJMP(luaL_argerror(L, first + idx, "string expected")); memcpy(trash.area, argp[idx].data.str.area, argp[idx].data.str.data); trash.area[argp[idx].data.str.data] = 0;