mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 05:48:05 +00:00
scm: Check for cmsg not to be truncated when receiving fds
Otherwise we can get stuck waiting for more data in vain. Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
5e95df84f9
commit
ab806ebc03
@ -102,6 +102,8 @@ int recv_fds(int sock, int *fds, int nr_fds, char *flags)
|
||||
cmsg = CMSG_FIRSTHDR(&fdset.hdr);
|
||||
if (!cmsg || cmsg->cmsg_type != SCM_RIGHTS)
|
||||
return -EINVAL;
|
||||
if (fdset.hdr.msg_flags & MSG_CTRUNC)
|
||||
return -ENFILE;
|
||||
|
||||
min_fd = (cmsg->cmsg_len - sizeof(struct cmsghdr)) / sizeof(int);
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user