aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Vivier <laurent@vivier.eu>2015-10-28 21:40:46 +0100
committerRiku Voipio <riku.voipio@linaro.org>2016-01-08 15:20:35 +0200
commit861d72cd28b5793fc367c46b7821a5372b66e3f4 (patch)
treeb476c7852734fa7f8597b0dd98787000bf8721d2
parent0cf227229bfd288a67fd9d4005ee01ffdb492c70 (diff)
linux-user: check fd is >= 0 in fd_trans_host_to_target_data/fd_trans_host_to_target_addr
Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
-rw-r--r--linux-user/syscall.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 94d64fa30d..ff20ea7d74 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;