diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2016-07-07 15:44:43 +0100 |
---|---|---|
committer | Riku Voipio <riku.voipio@linaro.org> | 2016-07-19 15:23:17 +0300 |
commit | a1e221929f570cc84661158421f942b3328a9fd1 (patch) | |
tree | ff0d7cfba933de9ee8d7dd4dd9a00b793e795105 /qemu-io-cmds.c | |
parent | 31efaef1d9b80b7803e22ef28ffc51df04db60ab (diff) |
linux-user: Handle short lengths in host_to_target_sockaddr()
If userspace specifies a short buffer for a target sockaddr,
the kernel will only copy in as much as it has space for
(or none at all if the length is zero) -- see the kernel
move_addr_to_user() function. Mimic this in QEMU's
host_to_target_sockaddr() routine.
In particular, this fixes a segfault running the LTP
recvfrom01 test, where the guest makes a recvfrom()
call with a bad buffer pointer and other parameters which
cause the kernel to set the addrlen to zero; because we
did not skip the attempt to swap the sa_family field we
segfaulted on the bad address.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Diffstat (limited to 'qemu-io-cmds.c')
0 files changed, 0 insertions, 0 deletions