From: Alan Cox Date: Fri, 21 Nov 2014 15:06:11 +0000 (+0000) Subject: usermem: always trap NULL pointers X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=c789eeb412a937a2b40601f122687887c721e840;p=FUZIX.git usermem: always trap NULL pointers Low vectors are hard due to the cp/mn emulation --- diff --git a/Kernel/usermem.c b/Kernel/usermem.c index fae355d6..78257d2b 100644 --- a/Kernel/usermem.c +++ b/Kernel/usermem.c @@ -11,7 +11,9 @@ /* This checks to see if a user-supplied address is legitimate */ usize_t valaddr(const char *base, usize_t size) { - if (base < (const char *)PROGBASE || base + size < base) + /* FIXME: for Z80 we should make this a udata field so that cp/m + emulation alone can touch below 0x100 */ + if (!base || base < (const char *)PROGBASE || base + size < base) size = 0; else if (base + size > (const char *)udata.u_top) size = (char *)udata.u_top - base;