From: Christian Brauner Date: Thu, 15 Jul 2021 16:47:27 +0000 (+0200) Subject: af_unix: report error when no fd is to be sent X-Git-Tag: lxc-5.0.0~137^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F3907%2Fhead;p=thirdparty%2Flxc.git af_unix: report error when no fd is to be sent Fixes: #3624 Signed-off-by: Christian Brauner --- diff --git a/src/lxc/af_unix.c b/src/lxc/af_unix.c index 14d3160cd..327b4df5b 100644 --- a/src/lxc/af_unix.c +++ b/src/lxc/af_unix.c @@ -121,6 +121,9 @@ int lxc_abstract_unix_send_fds_iov(int fd, const int *sendfds, int num_sendfds, struct cmsghdr *cmsg = NULL; size_t cmsgbufsize = CMSG_SPACE(num_sendfds * sizeof(int)); + if (num_sendfds <= 0) + return ret_errno(EINVAL); + cmsgbuf = malloc(cmsgbufsize); if (!cmsgbuf) return ret_errno(-ENOMEM);