]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
af_unix: vet all parameters
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 26 Feb 2021 21:37:30 +0000 (22:37 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 26 Feb 2021 21:37:30 +0000 (22:37 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/af_unix.c

index 6a016b0fa368dae7590bcc35b593b56c91ce6252..b491b95078b71a24cfd28ca302f93c9297773dc3 100644 (file)
@@ -182,6 +182,12 @@ static ssize_t lxc_abstract_unix_recv_fds_iov(int fd,
        if (hweight32((ret_fds->flags & ~UNIX_FDS_ACCEPT_NONE)) > 1)
                return ret_errno(EINVAL);
 
+       if (ret_fds->fd_count_max >= KERNEL_SCM_MAX_FD)
+               return ret_errno(EINVAL);
+
+       if (ret_fds->fd_count_ret != 0)
+               return ret_errno(EINVAL);
+
        cmsgbuf = zalloc(cmsgbufsize);
        if (!cmsgbuf)
                return ret_errno(ENOMEM);