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.
This commit is contained in:
Lukas Sismis
2026-09-08 20:24:50 +02:00
committed by Victor Julien
parent c8ac53c95b
commit 59358d6967
+3
View File
@@ -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);