mirror of
https://github.com/OISF/suricata.git
synced 2026-10-12 02:07:10 +00:00
lua/dataset: avoid uninitialized pointer use
Uninitialised pointer dereference: lua_newuserdata() returns uninitialised heap, so s->set contains garbage until :get() is called. LuaDatasetAdd() then dereferences this wild pointer. Address by memsetting the whole object.
This commit is contained in:
@@ -105,6 +105,7 @@ static int LuaDatasetNew(lua_State *luastate)
|
||||
if (s == NULL) {
|
||||
LUA_ERROR("failed to get userdata");
|
||||
}
|
||||
memset(s, 0, sizeof(*s));
|
||||
luaL_getmetatable(luastate, "dataset::metatable");
|
||||
lua_setmetatable(luastate, -2);
|
||||
SCLogDebug("new:done");
|
||||
|
||||
Reference in New Issue
Block a user