vt(4): Fix out-of-bounds array access in VT_ACTIVATE ioctl handling

CID:		1229964
MFC after:	3 days
This commit is contained in:
Jean-Sébastien Pédron 2014-09-18 12:20:19 +00:00
parent d1d469e22b
commit 46867de5dd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=271756

View File

@ -2131,7 +2131,7 @@ vtterm_ioctl(struct terminal *tm, u_long cmd, caddr_t data,
win = *(int *)data - 1;
DPRINTF(5, "%s%d: VT_ACTIVATE ttyv%d ", SC_DRIVER_NAME,
VT_UNIT(vw), win);
if ((win > VT_MAXWINDOWS) || (win < 0))
if ((win >= VT_MAXWINDOWS) || (win < 0))
return (EINVAL);
return (vt_proc_window_switch(vd->vd_windows[win]));
}