From c75b75acb002128425f427373f4b82a83d228823 Mon Sep 17 00:00:00 2001 From: Uwe Stuehler Date: Sat, 5 Nov 2005 16:04:21 +0000 Subject: Check the screen number before using it as an index. "correct" miod@ --- sys/dev/wscons/wsdisplay.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sys/dev') diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c index 22050d83220..8c412d5c8b7 100644 --- a/sys/dev/wscons/wsdisplay.c +++ b/sys/dev/wscons/wsdisplay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsdisplay.c,v 1.64 2005/09/27 21:45:20 miod Exp $ */ +/* $OpenBSD: wsdisplay.c,v 1.65 2005/11/05 16:04:20 uwe Exp $ */ /* $NetBSD: wsdisplay.c,v 1.82 2005/02/27 00:27:52 perry Exp $ */ /* @@ -920,6 +920,9 @@ wsdisplayioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) if (ISWSDISPLAYCTL(dev)) return (wsdisplay_cfg_ioctl(sc, cmd, data, flag, p)); + if (WSDISPLAYSCREEN(dev) >= WSDISPLAY_MAXSCREEN) + return (ENODEV); + if ((scr = sc->sc_scr[WSDISPLAYSCREEN(dev)]) == NULL) return (ENXIO); -- cgit v1.2.3