qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v5 01/10] linux-user/syscall: Verify recvfrom(addr)


From: Philippe Mathieu-Daudé
Subject: [Qemu-devel] [PATCH v5 01/10] linux-user/syscall: Verify recvfrom(addr) is user-writable
Date: Thu, 11 Oct 2018 00:36:47 +0200

Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
Tested-By: Guido Günther <address@hidden>
Reviewed-by: Laurent Vivier <address@hidden>
---
 linux-user/syscall.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index ae3c0dfef7..ea503381aa 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -2968,6 +2968,11 @@ static abi_long do_recvfrom(int fd, abi_ulong msg, 
size_t len, int flags,
             ret = -TARGET_EINVAL;
             goto fail;
         }
+        if (!access_ok(VERIFY_WRITE, target_addr, addrlen)) {
+            ret = -TARGET_EFAULT;
+            goto fail;
+        }
+
         addr = alloca(addrlen);
         ret = get_errno(safe_recvfrom(fd, host_msg, len, flags,
                                       addr, &addrlen));
-- 
2.19.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]