Skip to content

Commit

Permalink
af_unix: report error when no fd is to be sent
Browse files Browse the repository at this point in the history
Fixes: #3624
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Jul 15, 2021
1 parent 0b9a29b commit e3e69be
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lxc/af_unix.c
Expand Up @@ -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);
Expand Down

0 comments on commit e3e69be

Please sign in to comment.