From 4abc3ac836ab03ead2c9d25e8c525fb8ee5e9e1e Mon Sep 17 00:00:00 2001 From: William Ahern Date: Thu, 11 Aug 2016 23:33:22 +0000 Subject: [PATCH] in notify.c use luaL_checkstack like we did in signal.c, because the caller could easily cause us to push more than LUA_MINSTACK values onto the stack --- src/notify.c | 1 + src/signal.c | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/notify.c b/src/notify.c index 1762fd8..eebcf19 100644 --- a/src/notify.c +++ b/src/notify.c @@ -191,6 +191,7 @@ static int ln_strflag(lua_State *L) { flags &= ~flag; if ((name = notify_strflag(flag))) { + luaL_checkstack(L, 1, "too many results"); lua_pushstring(L, name); count++; } diff --git a/src/signal.c b/src/signal.c index 53239ae..ac3990a 100644 --- a/src/signal.c +++ b/src/signal.c @@ -428,11 +428,11 @@ static int lsl_strflag(lua_State *L) { while ((flag = signal_flags(&flags))) { const char *txt; - if (!(txt = signal_strflag(flag))) - continue; - luaL_checkstack(L, 1, "too many arguments"); - lua_pushstring(L, txt); - count++; + if ((txt = signal_strflag(flag))) { + luaL_checkstack(L, 1, "too many results"); + lua_pushstring(L, txt); + count++; + } } }