]> git.ipfire.org Git - thirdparty/systemd.git/commit
sd-daemon: add fd array size safety check to sd_notify_with_fds() 35011/head
authorLennart Poettering <lennart@poettering.net>
Mon, 4 Nov 2024 10:18:29 +0000 (11:18 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 4 Nov 2024 11:10:09 +0000 (12:10 +0100)
commitcb42df5310e701b751331ae62432e3fb0df2f660
tree9d90259fd8fb3dc89669bfbef55dd86526c55d56
parent74806f71168baca9233bf70446a704644ad8febc
sd-daemon: add fd array size safety check to sd_notify_with_fds()

The previous commit removed the UINT_MAX check for the fd array. Let's
now re-add one, but at a better place, and with a more useful limit. As
it turns out the kernel does not allow passing more than 253 fds at the
same time, hence use that as limit. And do so immediately before
calculating the control buffer size, so that we catch multiplication
overflows.
man/sd_notify.xml
src/basic/missing_socket.h
src/libsystemd/sd-daemon/sd-daemon.c
src/notify/notify.c