ref: ffb28698bf5922f5d89a0d986fc6ab289fd5b6d3
parent: 4fd68773e2c5935b1b5bce0376ced783f87c7934
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu Jul 20 17:03:00 EDT 2017
kernel: fix bounds check in screenputc()
--- a/sys/src/9/bcm/screen.c
+++ b/sys/src/9/bcm/screen.c
@@ -303,7 +303,7 @@
static int *xp;
static int xbuf[256];
- if (xp < xbuf || xp >= &xbuf[sizeof(xbuf)])
+ if (xp < xbuf || xp >= &xbuf[nelem(xbuf)])
xp = xbuf;
switch (buf[0]) {
--- a/sys/src/9/omap/screen.c
+++ b/sys/src/9/omap/screen.c
@@ -576,7 +576,7 @@
static int *xp;
static int xbuf[256];
- if (xp < xbuf || xp >= &xbuf[sizeof(xbuf)])
+ if (xp < xbuf || xp >= &xbuf[nelem(xbuf)])
xp = xbuf;
switch (buf[0]) {
--- a/sys/src/9/pc/vga.c
+++ b/sys/src/9/pc/vga.c
@@ -53,7 +53,7 @@
int h, w, pos;
Rectangle r;
- if(xp < xbuf || xp >= &xbuf[sizeof(xbuf)])
+ if(xp < xbuf || xp >= &xbuf[nelem(xbuf)])
xp = xbuf;
h = scr->memdefont->height;