diff options
| author | Donald Lee <dlqs@gmx.com> | 2021-06-21 04:51:45 +0800 | 
|---|---|---|
| committer | Donald Lee <dlqs@gmx.com> | 2021-06-23 00:58:04 +0800 | 
| commit | 8192b47173db1745091b3ea2575787b040cbd774 (patch) | |
| tree | ad7a3df4a8cc35aa2a16c9dd4e9af2d8769f2b9c /lib/frrlua.c | |
| parent | 1e0e4d2355452d7537d406e9eb6ed0df8cb35d8c (diff) | |
lib: Pop tables off Lua stack when decoding
Signed-off-by: Donald Lee <dlqs@gmx.com>
Diffstat (limited to 'lib/frrlua.c')
| -rw-r--r-- | lib/frrlua.c | 13 | 
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/frrlua.c b/lib/frrlua.c index d6a0ef328e..36f1797473 100644 --- a/lib/frrlua.c +++ b/lib/frrlua.c @@ -76,6 +76,8 @@ void lua_decode_prefix(lua_State *L, int idx, struct prefix *prefix)  	lua_getfield(L, idx, "network");  	(void)str2prefix(lua_tostring(L, -1), prefix);  	lua_pop(L, 1); +	/* pop the table */ +	lua_pop(L, 1);  }  void *lua_toprefix(lua_State *L, int idx) @@ -147,6 +149,8 @@ void lua_decode_interface(lua_State *L, int idx, struct interface *ifp)  	lua_getfield(L, idx, "linklayer_type");  	ifp->ll_type = lua_tointeger(L, -1);  	lua_pop(L, 1); +	/* pop the table */ +	lua_pop(L, 1);  }  void *lua_tointerface(lua_State *L, int idx)  { @@ -174,6 +178,8 @@ void lua_decode_inaddr(lua_State *L, int idx, struct in_addr *inaddr)  	lua_getfield(L, idx, "value");  	inaddr->s_addr = lua_tointeger(L, -1);  	lua_pop(L, 1); +	/* pop the table */ +	lua_pop(L, 1);  }  void *lua_toinaddr(lua_State *L, int idx) @@ -202,6 +208,8 @@ void lua_decode_in6addr(lua_State *L, int idx, struct in6_addr *in6addr)  	lua_getfield(L, idx, "string");  	inet_pton(AF_INET6, lua_tostring(L, -1), in6addr);  	lua_pop(L, 1); +	/* pop the table */ +	lua_pop(L, 1);  }  void *lua_toin6addr(lua_State *L, int idx) @@ -229,6 +237,9 @@ void lua_decode_sockunion(lua_State *L, int idx, union sockunion *su)  {  	lua_getfield(L, idx, "string");  	str2sockunion(lua_tostring(L, -1), su); +	lua_pop(L, 1); +	/* pop the table */ +	lua_pop(L, 1);  }  void *lua_tosockunion(lua_State *L, int idx) @@ -247,6 +258,7 @@ void lua_pushtimet(lua_State *L, const time_t *time)  void lua_decode_timet(lua_State *L, int idx, time_t *t)  {  	*t = lua_tointeger(L, idx); +	lua_pop(L, 1);  }  void *lua_totimet(lua_State *L, int idx) @@ -266,6 +278,7 @@ void lua_decode_integerp(lua_State *L, int idx, long long *num)  {  	int isnum;  	*num = lua_tonumberx(L, idx, &isnum); +	lua_pop(L, 1);  	assert(isnum);  }  | 
