summaryrefslogtreecommitdiffstats
path: root/runtime/addr-map.c
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/addr-map.c')
-rw-r--r--runtime/addr-map.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/runtime/addr-map.c b/runtime/addr-map.c
index 8c0e84d8..a9aa8d88 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)