sysdeps-unix: On MSG_CTRUNC, close the fds we did receive
authorSimon McVittie <smcv@collabora.com>
Thu, 16 Apr 2020 13:45:11 +0000 (14:45 +0100)
committerSimon McVittie <smcv@collabora.com>
Tue, 2 Jun 2020 09:43:16 +0000 (10:43 +0100)
commit272d484283883fa9ff95b69d924fff6cd34842f5
tree6f4e5ddd0656b1a6c19f4cbaf2d2a2fd642c86e3
parent31297172f1ea6114072793ab24b338c7c251c47c
sysdeps-unix: On MSG_CTRUNC, close the fds we did receive

MSG_CTRUNC indicates that we have received fewer fds that we should
have done because the buffer was too small, but we were treating it
as though it indicated that we received *no* fds. If we received any,
we still have to make sure we close them, otherwise they will be leaked.

On the system bus, if an attacker can induce us to leak fds in this
way, that's a local denial of service via resource exhaustion.

Reported-by: Kevin Backhouse, GitHub Security Lab
Fixes: dbus#294
Fixes: CVE-2020-12049
Fixes: GHSL-2020-057
dbus/dbus-sysdeps-unix.c