kernel: awake: fix CID 174310: Out-of-bounds read

This commit is contained in:
Giacomo Tesio 2017-08-13 21:59:03 +02:00
parent 5f22403176
commit 033744b5be
1 changed files with 2 additions and 2 deletions

View File

@ -96,7 +96,7 @@ static const int awakeable_syscalls[] = {
[SysSemacquire] = 1,
[SysSemrelease] = 0,
[SysUnmount] = 0,
[SysAlarm] = 0,
[SysAlarm] = 0
};
#define DEBUG
@ -146,7 +146,7 @@ awake_can_interrupt(Syscalls scall)
{
if(scall == 0)
panic("awake_can_interrupts on page fault");
if(scall >= sizeof(awakeable_syscalls) - 1)
if(scall >= nelem(awakeable_syscalls) - 1)
panic("awake_can_interrupts: unknown syscall %d", scall);
return awakeable_syscalls[scall];
}