linux-user: fix recvmsg()/recvfrom() with netlink and MSG_TRUNC
commit2a03d3e6ae1b1ca86199a0c36a35e8ac847905f6
authorLaurent Vivier <laurent@vivier.eu>
Mon, 20 Aug 2018 17:15:54 +0000 (20 19:15 +0200)
committerLaurent Vivier <laurent@vivier.eu>
Mon, 20 Aug 2018 20:03:49 +0000 (20 22:03 +0200)
treed1833d5fc846c95ee59b1db644811a23270ea5d7
parent5b38d0264064055255db991e29d938491f9e8a32
linux-user: fix recvmsg()/recvfrom() with netlink and MSG_TRUNC

If recvmsg()/recvfrom() are used with the MSG_TRUNC flag, they return the
real length even if it was longer than the passed buffer.
So when we translate the buffer we must check we don't go beyond the
end of the buffer.

Bug: https://github.com/vivier/qemu-m68k/issues/33
Reported-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20180820171557.7734-2-laurent@vivier.eu>
linux-user/syscall.c