[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 01/38] linux-user: Check array bounds in errno con
From: |
riku . voipio |
Subject: |
[Qemu-devel] [PULL v2 01/38] linux-user: Check array bounds in errno conversion |
Date: |
Fri, 27 May 2016 15:59:52 +0300 |
From: Timothy E Baldwin <address@hidden>
Check array bounds in host_to_target_errno() and target_to_host_errno().
Signed-off-by: Timothy Edward Baldwin <address@hidden>
Message-id: address@hidden
[PMM: Add a lower-bound check, use braces on if(), tweak commit message]
Signed-off-by: Peter Maydell <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
Reviewed-by: Laurent Vivier <address@hidden>
---
linux-user/syscall.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 032d338..5246f36 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -619,15 +619,19 @@ static uint16_t
host_to_target_errno_table[ERRNO_TABLE_SIZE] = {
static inline int host_to_target_errno(int err)
{
- if(host_to_target_errno_table[err])
+ if (err >= 0 && err < ERRNO_TABLE_SIZE &&
+ host_to_target_errno_table[err]) {
return host_to_target_errno_table[err];
+ }
return err;
}
static inline int target_to_host_errno(int err)
{
- if (target_to_host_errno_table[err])
+ if (err >= 0 && err < ERRNO_TABLE_SIZE &&
+ target_to_host_errno_table[err]) {
return target_to_host_errno_table[err];
+ }
return err;
}
--
2.1.4
- [Qemu-devel] [PULL v2 00/38] linux-user pull request, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 04/38] linux-user: Define TARGET_ERESTART* errno values, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 01/38] linux-user: Check array bounds in errno conversion,
riku . voipio <=
- [Qemu-devel] [PULL v2 06/38] linux-user: Support for restarting system calls for x86 targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 09/38] linux-user: Support for restarting system calls for PPC targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 08/38] linux-user: Support for restarting system calls for MIPS targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 02/38] linux-user: Consistently return host errnos from do_openat(), riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 07/38] linux-user: Support for restarting system calls for ARM targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 03/38] linux-user: Reindent signal handling, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 05/38] linux-user: Renumber TARGET_QEMU_ESIGRETURN, make it not arch-specific, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 10/38] linux-user: Support for restarting system calls for SPARC targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 16/38] linux-user: Support for restarting system calls for S390 targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 11/38] linux-user: Support for restarting system calls for SH4 targets, riku . voipio, 2016/05/27