]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
af_unix: report error when no fd is to be sent 3907/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 15 Jul 2021 16:47:27 +0000 (18:47 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 15 Jul 2021 16:47:27 +0000 (18:47 +0200)
Fixes: #3624
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/af_unix.c

index 14d3160cddfa7dc92cf77ab714b6c8d1991eb81c..327b4df5bf6d47c1d1232595bc11392b2eb31b96 100644 (file)
@@ -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);