From 07539d2377f7e38eaebc7d0c71cb8d7540e8a540 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Thu, 25 Jul 2024 10:06:34 +0200 Subject: [PATCH] sd-event: do not assert on invalid signal 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) Resolves: RHEL-51171 --- src/libsystemd/sd-event/sd-event.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c index a1305ef014..ffea0ba082 100644 --- a/src/libsystemd/sd-event/sd-event.c +++ b/src/libsystemd/sd-event/sd-event.c @@ -3866,7 +3866,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];