summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Brolley <brolley@redhat.com>2009-09-04 12:35:26 -0400
committerDave Brolley <brolley@redhat.com>2009-09-04 12:35:26 -0400
commite8d12bbfb8dcdd494b9ecd9d4d4a275d5a8c6124 (patch)
tree118f3e2fd0580a284ae8f37173fa2065cfc2d037
parenta5d268f35032292b8f85cc75a316930ed0b95aab (diff)
downloadsystemtap-steved-e8d12bbfb8dcdd494b9ecd9d4d4a275d5a8c6124.tar.gz
systemtap-steved-e8d12bbfb8dcdd494b9ecd9d4d4a275d5a8c6124.tar.xz
systemtap-steved-e8d12bbfb8dcdd494b9ecd9d4d4a275d5a8c6124.zip
Check for bad address range or size in lookup_bad_addr.
-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)