From: Alan Cox Date: Sat, 19 Jan 2019 19:14:56 +0000 (+0000) Subject: usermem: fix dumb error where some out of range addresses were not errorred X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=9a3b936aee427652849705ed9e820aa7cb3045ab;p=FUZIX.git usermem: fix dumb error where some out of range addresses were not errorred --- diff --git a/Kernel/usermem.c b/Kernel/usermem.c index 6a966645..4490247b 100644 --- a/Kernel/usermem.c +++ b/Kernel/usermem.c @@ -16,7 +16,8 @@ /* This checks to see if a user-supplied address is legitimate */ usize_t valaddr(const char *base, usize_t size) { - if (!base || base < (const char *)PROGBASE || base + size < base) + if (!base || base < (const char *)PROGBASE || base + size < base || + base > (const char *)(size_t)udata.u_top) size = 0; else if (base + size > (const char *)(size_t)udata.u_top) size = (char *)(size_t)udata.u_top - base;