Skip to content

Commit

Permalink
sd-event: do not assert on invalid signal
Browse files Browse the repository at this point in the history
The signalfd_siginfo struct is received from outside via a FD, hence
assert() is not appropriate way to check it. Just do a normal runtime
check.

(cherry picked from commit 7a64c5f23efbb51fe4f1229c1a8aed6dd858a0a9)
(cherry picked from commit 7a48ea958bf146a45cb4a3b7ff7aeb5885469196)
(cherry picked from commit 5fa8b5d)
(cherry picked from commit 74fa56e)
  • Loading branch information
dtardon authored and bluca committed Aug 19, 2024
1 parent 75aefdd commit e681d16
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/libsystemd/sd-event/sd-event.c
Original file line number Diff line number Diff line change
Expand Up @@ -3429,7 +3429,8 @@ static int process_signal(sd_event *e, struct signal_data *d, uint32_t events, i
if (_unlikely_(n != sizeof(si)))
return -EIO;

assert(SIGNAL_VALID(si.ssi_signo));
if (_unlikely_(!SIGNAL_VALID(si.ssi_signo)))
return -EINVAL;

if (e->signal_sources)
s = e->signal_sources[si.ssi_signo];
Expand Down

0 comments on commit e681d16

Please sign in to comment.