linux-user: fd_trans_host_to_target_data() must process only received data
authorLaurent Vivier <laurent@vivier.eu>
Thu, 16 Jun 2016 19:01:36 +0000 (21:01 +0200)
committerRiku Voipio <riku.voipio@linaro.org>
Sun, 26 Jun 2016 10:17:22 +0000 (13:17 +0300)
if we process the whole buffer, the netlink helpers can try
to swap invalid data.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
linux-user/syscall.c

index 33409c0..4b0d791 100644 (file)
@@ -2991,7 +2991,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
             len = ret;
             if (fd_trans_host_to_target_data(fd)) {
                 ret = fd_trans_host_to_target_data(fd)(msg.msg_iov->iov_base,
-                                                       msg.msg_iov->iov_len);
+                                                       len);
             } else {
                 ret = host_to_target_cmsg(msgp, &msg);
             }