From: Alan Cox Date: Mon, 29 Aug 2016 16:46:10 +0000 (+0100) Subject: devsys: check for over end copies for ps X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=64f497a015558fded362b18e965371ec69385fde;p=FUZIX.git devsys: check for over end copies for ps Doesn't matter too much today but it will when we have MMU support --- diff --git a/Kernel/devsys.c b/Kernel/devsys.c index 8850450d..a76df30f 100644 --- a/Kernel/devsys.c +++ b/Kernel/devsys.c @@ -39,7 +39,9 @@ int sys_read(uint8_t minor, uint8_t rawflag, uint8_t flag) uzero(udata.u_base, udata.u_count); return udata.u_count; case 3: - if (udata.u_offset >= PTABSIZE * sizeof(struct p_tab)) + if (udata.u_count > sizeof(struct p_tab)) + udata.u_count = sizeof(struct p_tab); + if (udata.u_offset + udata.u_count > PTABSIZE * sizeof(struct p_tab)) return 0; return uputsys(addr + udata.u_offset, udata.u_count); #ifdef CONFIG_NET_NATIVE