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).
pull/13361/head
Jason Ish 6 months ago committed by Victor Julien
parent ce7cdd6f9a
commit 2cb19ad72f

@ -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;
}

Loading…
Cancel
Save