qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] mmap: add check if requested memory area fits targe


From: Kirill A. Shutemov
Subject: [Qemu-devel] [PATCH] mmap: add check if requested memory area fits target address space
Date: Fri, 17 Oct 2008 09:34:23 +0300

Signed-off-by: Kirill A. Shutemov <address@hidden>
---
 linux-user/mmap.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index bc20f4b..9a2f355 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -388,6 +388,11 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int 
prot,
         end = start + len;
         real_end = HOST_PAGE_ALIGN(end);
 
+        if ((unsigned long)start + len > (abi_ulong) -1) {
+            errno = EINVAL;
+            goto fail;
+        }
+
         for(addr = real_start; addr < real_end; addr += TARGET_PAGE_SIZE) {
             flg = page_get_flags(addr);
             if (flg & PAGE_RESERVED) {
-- 
1.5.6.5.GIT





reply via email to

[Prev in Thread] Current Thread [Next in Thread]