summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2009-05-31 16:57:35 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2009-05-31 16:57:35 +0000
commit5e93ce8f9b526e75ec999ac853aeff75ed226a9f (patch)
tree1edcb2864d705d9bb89442aa37d6b8efc5f795f4
parent04684ad8eeedc3a81c03b3dabbab289dc8463cdb (diff)
Do not access sc_scr[-1] from the wsmoused-related code if
wsdisplay_switch(..., WSDISPLAY_NULLSCREEN, ...).
-rw-r--r--sys/dev/wscons/wsdisplay.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c
index 4dff4d6b803..20059ec0d81 100644
--- a/sys/dev/wscons/wsdisplay.c
+++ b/sys/dev/wscons/wsdisplay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsdisplay.c,v 1.90 2009/05/31 16:56:10 miod Exp $ */
+/* $OpenBSD: wsdisplay.c,v 1.91 2009/05/31 16:57:34 miod Exp $ */
/* $NetBSD: wsdisplay.c,v 1.82 2005/02/27 00:27:52 perry Exp $ */
/*
@@ -1853,7 +1853,8 @@ wsdisplay_switch(struct device *dev, int no, int waitok)
*/
if (!(scr->scr_flags & SCR_GRAPHICS) &&
- (!(sc->sc_scr[no]->scr_flags & SCR_GRAPHICS))) {
+ (no == WSDISPLAY_NULLSCREEN ||
+ !(sc->sc_scr[no]->scr_flags & SCR_GRAPHICS))) {
/* switching from a text console to another text console */
/* XXX evaluated when the X-server starts or stops, see above */
@@ -1862,7 +1863,8 @@ wsdisplay_switch(struct device *dev, int no, int waitok)
}
if (!(scr->scr_flags & SCR_GRAPHICS) &&
- (sc->sc_scr[no]->scr_flags & SCR_GRAPHICS)) {
+ (no != WSDISPLAY_NULLSCREEN &&
+ (sc->sc_scr[no]->scr_flags & SCR_GRAPHICS))) {
/* switching from a text console to a graphic console */
/* remove a potential wsmoused(8) selection */
@@ -1871,7 +1873,8 @@ wsdisplay_switch(struct device *dev, int no, int waitok)
}
if ((scr->scr_flags & SCR_GRAPHICS) &&
- !(sc->sc_scr[no]->scr_flags & SCR_GRAPHICS)) {
+ (no == WSDISPLAY_NULLSCREEN ||
+ !(sc->sc_scr[no]->scr_flags & SCR_GRAPHICS))) {
/* switching from a graphic console to a text console */
wsmoused_wakeup(sc);