lua: validate signature argument to bytevar.map

bytevar.map() read its first argument as a Signature pointer.
Dereferencing the full userdata stopped the engine at rule load.
The commit provides a more intuitive user message when the user
provides full user data.
pull/16213/head
Lukas Sismis 2 months ago committed by Victor Julien
parent c8ac53c95b
commit 59358d6967

@ -38,6 +38,9 @@ static DetectLuaData *GetLuaData(lua_State *luastate)
static int LuaBytevarMap(lua_State *L)
{
if (!lua_islightuserdata(L, -2)) {
return luaL_error(L, "bytevar.map: first argument must be the signature passed to init");
}
const Signature *s = lua_touserdata(L, -2);
const char *name = luaL_checkstring(L, -1);
DetectLuaData *ld = GetLuaData(L);

Loading…
Cancel
Save