]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-event: do not assert on invalid signal
authorDavid Tardon <dtardon@redhat.com>
Thu, 25 Jul 2024 08:06:34 +0000 (10:06 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Thu, 25 Jul 2024 10:57:05 +0000 (11:57 +0100)
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.

src/libsystemd/sd-event/sd-event.c

index f1aed5de60e256ed59a0797c792311b6c3ae9258..a593d0e50dbfe558c313d26cbb8dbd3e3ad2206f 100644 (file)
@@ -3871,7 +3871,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];