From a852e5a62dbd3940c20102aecb8cf0282a36bc8c Mon Sep 17 00:00:00 2001 From: Donald Lee Date: Mon, 9 Aug 2021 17:18:14 +0800 Subject: [PATCH 1/2] lib: check return on str2sockunion Signed-off-by: Donald Lee --- lib/frrlua.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/frrlua.c b/lib/frrlua.c index 928780f2d4..54ebcf7e22 100644 --- a/lib/frrlua.c +++ b/lib/frrlua.c @@ -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) { 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); /* pop the table */ lua_pop(L, 1); From 0db2bfc5accbe190325e3f50874f3cf4b6ee9229 Mon Sep 17 00:00:00 2001 From: Donald Lee Date: Tue, 10 Aug 2021 04:28:33 +0800 Subject: [PATCH 2/2] lib: Remove extraneous braces Signed-off-by: Donald Lee --- lib/frrlua.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/frrlua.c b/lib/frrlua.c index 54ebcf7e22..00491568f6 100644 --- a/lib/frrlua.c +++ b/lib/frrlua.c @@ -240,9 +240,9 @@ void lua_pushsockunion(lua_State *L, const union sockunion *su) void lua_decode_sockunion(lua_State *L, int idx, union sockunion *su) { lua_getfield(L, idx, "string"); - if (str2sockunion(lua_tostring(L, -1), su) < 0) { + if (str2sockunion(lua_tostring(L, -1), su) < 0) zlog_err("Lua hook call: Failed to decode sockunion"); - } + lua_pop(L, 1); /* pop the table */ lua_pop(L, 1);