]> git.proxmox.com Git - mirror_qemu.git/commitdiff
linux-user: check fd is >= 0 in fd_trans_host_to_target_data/fd_trans_host_to_target_addr
authorLaurent Vivier <laurent@vivier.eu>
Wed, 28 Oct 2015 20:40:46 +0000 (21:40 +0100)
committerRiku Voipio <riku.voipio@linaro.org>
Fri, 8 Jan 2016 13:20:35 +0000 (15:20 +0200)
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
linux-user/syscall.c

index 94d64fa30ddcc636198c6eb65025cd9d95c2034e..ff20ea7d74db08b86d8e6532e5c544cae81f0032 100644 (file)
@@ -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;