diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-12-02 19:11:12 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-12-02 19:11:12 +0000 |
commit | 1659880111098d72d04a0bd82814b15331574f01 (patch) | |
tree | 33321d9e2271bd340658bf15ab375a5298ecdad4 | |
parent | 7dca3c983e2fdf6a7926086522bf397531f6a2f6 (diff) |
In alloc_attr(), make sure xxansitopc[] indicies are within bounds.
-rw-r--r-- | sys/dev/ic/vga.c | 6 | ||||
-rw-r--r-- | sys/dev/isa/ega.c | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/sys/dev/ic/vga.c b/sys/dev/ic/vga.c index a1560921ecc..a80b3392163 100644 --- a/sys/dev/ic/vga.c +++ b/sys/dev/ic/vga.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vga.c,v 1.42 2006/11/29 19:11:15 miod Exp $ */ +/* $OpenBSD: vga.c,v 1.43 2006/12/02 19:11:09 miod Exp $ */ /* $NetBSD: vga.c,v 1.28.2.1 2000/06/30 16:27:47 simonb Exp $ */ /* @@ -984,10 +984,10 @@ vga_alloc_attr(id, fg, bg, flags, attrp) if (flags & (WSATTR_UNDERLINE | WSATTR_REVERSE)) return (EINVAL); if (flags & WSATTR_WSCOLORS) - *attrp = fgansitopc[fg] | bgansitopc[bg]; + *attrp = fgansitopc[fg & 7] | bgansitopc[bg & 7]; else *attrp = 7; - if (flags & WSATTR_HILIT) + if ((flags & WSATTR_HILIT) || (fg & 8) || (bg & 8)) *attrp += 8; } if (flags & WSATTR_BLINK) diff --git a/sys/dev/isa/ega.c b/sys/dev/isa/ega.c index 3777e5a3f51..a63a028455a 100644 --- a/sys/dev/isa/ega.c +++ b/sys/dev/isa/ega.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ega.c,v 1.10 2006/11/29 19:08:22 miod Exp $ */ +/* $OpenBSD: ega.c,v 1.11 2006/12/02 19:11:11 miod Exp $ */ /* $NetBSD: ega.c,v 1.4.4.1 2000/06/30 16:27:47 simonb Exp $ */ /* @@ -888,10 +888,10 @@ ega_alloc_attr(id, fg, bg, flags, attrp) if (flags & (WSATTR_UNDERLINE | WSATTR_REVERSE)) return (EINVAL); if (flags & WSATTR_WSCOLORS) - *attrp = fgansitopc[fg] | bgansitopc[bg]; + *attrp = fgansitopc[fg & 7] | bgansitopc[bg & 7]; else *attrp = 7; - if (flags & WSATTR_HILIT) + if ((flags & WSATTR_HILIT) || (fg & 8) || (bg & 8)) *attrp += 8; } if (flags & WSATTR_BLINK) |