From e8d12bbfb8dcdd494b9ecd9d4d4a275d5a8c6124 Mon Sep 17 00:00:00 2001 From: Dave Brolley Date: Fri, 4 Sep 2009 12:35:26 -0400 Subject: [PATCH] Check for bad address range or size in lookup_bad_addr. --- runtime/addr-map.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/runtime/addr-map.c b/runtime/addr-map.c index 8c0e84d8c..a9aa8d88d 100644 --- a/runtime/addr-map.c +++ b/runtime/addr-map.c @@ -110,6 +110,10 @@ lookup_bad_addr(unsigned long addr, size_t size) { struct addr_map_entry* result = 0; + /* Is this a valid memory access? */ + if (size == 0 || ULONG_MAX - addr < size - 1) + return 1; + #ifndef STP_PRIVILEGED /* Unprivileged users must not access kernel space memory. */ if (addr + size > TASK_SIZE) -- 2.43.5