Skip to content

Commit

Permalink
linux-user: check fd is >= 0 in fd_trans_host_to_target_data/fd_trans…
Browse files Browse the repository at this point in the history
…_host_to_target_addr

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
  • Loading branch information
vivier authored and Riku Voipio committed Jan 8, 2016
1 parent 0cf2272 commit 861d72c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions linux-user/syscall.c
Expand Up @@ -309,15 +309,15 @@ 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;
}

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;
Expand Down

0 comments on commit 861d72c

Please sign in to comment.