[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 5/5] linux-user: check fd is >= 0 in fd_trans_hos
From: |
Laurent Vivier |
Subject: |
[Qemu-devel] [PATCH v3 5/5] linux-user: check fd is >= 0 in fd_trans_host_to_target_data/fd_trans_host_to_target_addr |
Date: |
Wed, 28 Oct 2015 21:40:46 +0100 |
Signed-off-by: Laurent Vivier <address@hidden>
---
linux-user/syscall.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 22b28a4..eb45e72 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -309,7 +309,7 @@ static unsigned int target_fd_max;
static TargetFdDataFunc fd_trans_host_to_target_data(int fd)
{
- if (fd < target_fd_max && target_fd_trans[fd]) {
+ if (fd >= 0 && fd < target_fd_max && target_fd_trans[fd]) {
return target_fd_trans[fd]->host_to_target_data;
}
return NULL;
@@ -317,7 +317,7 @@ static TargetFdDataFunc fd_trans_host_to_target_data(int fd)
static TargetFdAddrFunc fd_trans_target_to_host_addr(int fd)
{
- if (fd < target_fd_max && target_fd_trans[fd]) {
+ if (fd >= 0 && fd < target_fd_max && target_fd_trans[fd]) {
return target_fd_trans[fd]->target_to_host_addr;
}
return NULL;
--
2.4.3
- [Qemu-devel] [PATCH v3 0/5] linux-user: manage SOCK_PACKET socket type, Laurent Vivier, 2015/10/28
- [Qemu-devel] [PATCH v3 4/5] linux-user: manage bind with a socket of SOCK_PACKET type., Laurent Vivier, 2015/10/28
- [Qemu-devel] [PATCH v3 5/5] linux-user: check fd is >= 0 in fd_trans_host_to_target_data/fd_trans_host_to_target_addr,
Laurent Vivier <=
- [Qemu-devel] [PATCH v3 1/5] linux-user: SOCK_PACKET uses network endian to encode protocol in socket(), Laurent Vivier, 2015/10/28
- [Qemu-devel] [PATCH v3 2/5] linux-user: rename TargetFdFunc to TargetFdDataFunc, and structure fields accordingly, Laurent Vivier, 2015/10/28
- [Qemu-devel] [PATCH v3 3/5] linux-user: add a function hook to translate sockaddr, Laurent Vivier, 2015/10/28
- Re: [Qemu-devel] [PATCH v3 0/5] linux-user: manage SOCK_PACKET socket type, Peter Maydell, 2015/10/28