From: Jason Ish Date: Mon, 2 Jun 2025 15:07:20 +0000 (-0600) Subject: lua: fix coverity unchecked return X-Git-Tag: suricata-8.0.0-rc1~194 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=2cb19ad72ff89f0ecf9328bff05b56080a545e90;p=thirdparty%2Fsuricata.git lua: fix coverity unchecked return CID 1648351: (#1 of 1): Unchecked return value (CHECKED_RETURN) 1. check_return: Calling lua_getstack without checking return value (as is done elsewhere 9 out of 10 times). --- diff --git a/src/util-lua-sandbox.c b/src/util-lua-sandbox.c index ffe8e5b5ad..7dc532b6bc 100644 --- a/src/util-lua-sandbox.c +++ b/src/util-lua-sandbox.c @@ -31,6 +31,7 @@ #include "util-debug.h" #include "util-lua-sandbox.h" #include "util-lua-builtins.h" +#include "util-validate.h" #define SANDBOX_CTX "SANDBOX_CTX" @@ -101,13 +102,13 @@ static int LuaBlockedFunction(lua_State *L) SCLuaSbState *context = SCLuaSbGetContext(L); context->blocked_function_error = true; lua_Debug ar; - lua_getstack(L, 0, &ar); - lua_getinfo(L, "n", &ar); - if (ar.name) { + if (lua_getstack(L, 0, &ar) && lua_getinfo(L, "n", &ar) && ar.name) { luaL_error(L, "Blocked Lua function called: %s", ar.name); } else { luaL_error(L, "Blocked Lua function: name not available"); } + /* never reached */ + DEBUG_VALIDATE_BUG_ON(1); return -1; }