mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-28 04:43:54 -06:00
libvhost-user.c: add assertion to vu_message_read_default
Explain Coverity that we are not going to overflow vmsg->fds. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Message-Id: <20230925194040.68592-5-vsementsov@yandex-team.ru> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
f1a153857a
commit
a6f4d2ec42
1 changed files with 1 additions and 0 deletions
|
@ -322,6 +322,7 @@ vu_message_read_default(VuDev *dev, int conn_fd, VhostUserMsg *vmsg)
|
||||||
if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) {
|
if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) {
|
||||||
fd_size = cmsg->cmsg_len - CMSG_LEN(0);
|
fd_size = cmsg->cmsg_len - CMSG_LEN(0);
|
||||||
vmsg->fd_num = fd_size / sizeof(int);
|
vmsg->fd_num = fd_size / sizeof(int);
|
||||||
|
assert(fd_size < VHOST_MEMORY_BASELINE_NREGIONS);
|
||||||
memcpy(vmsg->fds, CMSG_DATA(cmsg), fd_size);
|
memcpy(vmsg->fds, CMSG_DATA(cmsg), fd_size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue