diff --git a/lib/util/event.c b/lib/util/event.c index 42d876339..b322a9ef8 100644 --- a/lib/util/event.c +++ b/lib/util/event.c @@ -725,6 +725,12 @@ void sudo_ev_loopexit_v1(struct sudo_event_base *base) { debug_decl(sudo_ev_loopexit, SUDO_DEBUG_EVENT) + + if (base == NULL) { + if ((base = default_base) == NULL) + debug_return; + } + /* SUDO_EVBASE_LOOPBREAK trumps SUDO_EVBASE_LOOPEXIT */ if (!ISSET(base->flags, SUDO_EVBASE_LOOPBREAK)) { /* SUDO_EVBASE_LOOPEXIT trumps SUDO_EVBASE_LOOPCONT */ @@ -738,6 +744,12 @@ void sudo_ev_loopbreak_v1(struct sudo_event_base *base) { debug_decl(sudo_ev_loopbreak, SUDO_DEBUG_EVENT) + + if (base == NULL) { + if ((base = default_base) == NULL) + debug_return; + } + /* SUDO_EVBASE_LOOPBREAK trumps SUDO_EVBASE_LOOP{CONT,EXIT,ONCE}. */ CLR(base->flags, (SUDO_EVBASE_LOOPCONT|SUDO_EVBASE_LOOPEXIT|SUDO_EVBASE_LOOPONCE)); SET(base->flags, SUDO_EVBASE_LOOPBREAK); @@ -748,6 +760,12 @@ void sudo_ev_loopcontinue_v1(struct sudo_event_base *base) { debug_decl(sudo_ev_loopcontinue, SUDO_DEBUG_EVENT) + + if (base == NULL) { + if ((base = default_base) == NULL) + debug_return; + } + /* SUDO_EVBASE_LOOP{BREAK,EXIT} trumps SUDO_EVBASE_LOOPCONT */ if (!ISSET(base->flags, SUDO_EVBASE_LOOPONCE|SUDO_EVBASE_LOOPBREAK)) { SET(base->flags, SUDO_EVBASE_LOOPCONT); @@ -759,6 +777,11 @@ bool sudo_ev_got_exit_v1(struct sudo_event_base *base) { debug_decl(sudo_ev_got_exit, SUDO_DEBUG_EVENT) + + if (base == NULL) { + if ((base = default_base) == NULL) + debug_return_bool(false); + } debug_return_bool(ISSET(base->flags, SUDO_EVBASE_GOT_EXIT)); } @@ -766,6 +789,11 @@ bool sudo_ev_got_break_v1(struct sudo_event_base *base) { debug_decl(sudo_ev_got_break, SUDO_DEBUG_EVENT) + + if (base == NULL) { + if ((base = default_base) == NULL) + debug_return_bool(false); + } debug_return_bool(ISSET(base->flags, SUDO_EVBASE_GOT_BREAK)); }