From c2b06ebf8006a3ec8ebf36f12d800f23e4e79cdb Mon Sep 17 00:00:00 2001 From: Giacomo Tesio Date: Sun, 22 Jan 2017 00:34:17 +0100 Subject: [PATCH] kernel: fix out of bound read in trap() Reported by coverity, CID 155927: if vno == 32 it would access index 32 of excname at trap.c:339. --- sys/src/kern/amd64/trap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/src/kern/amd64/trap.c b/sys/src/kern/amd64/trap.c index 646df15..c3da721 100644 --- a/sys/src/kern/amd64/trap.c +++ b/sys/src/kern/amd64/trap.c @@ -332,7 +332,7 @@ trap(Ureg* ureg) preempted(); } } - else if(vno <= nelem(excname) && user){ + else if(vno < nelem(excname) && user){ spllo(); if(vno == 0xd) /* General Protection */ dumpregs(ureg);