Merge pull request #9337 from dlqs/lua2

lib: check return on str2sockunion
This commit is contained in:
Stephen Worley 2021-08-23 08:20:33 -06:00 committed by GitHub
commit 95b4a691dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -240,7 +240,9 @@ void lua_pushsockunion(lua_State *L, const union sockunion *su)
void lua_decode_sockunion(lua_State *L, int idx, union sockunion *su) void lua_decode_sockunion(lua_State *L, int idx, union sockunion *su)
{ {
lua_getfield(L, idx, "string"); lua_getfield(L, idx, "string");
(void)str2sockunion(lua_tostring(L, -1), su); if (str2sockunion(lua_tostring(L, -1), su) < 0)
zlog_err("Lua hook call: Failed to decode sockunion");
lua_pop(L, 1); lua_pop(L, 1);
/* pop the table */ /* pop the table */
lua_pop(L, 1); lua_pop(L, 1);