diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2017-07-20 21:03:00 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2017-07-20 21:03:00 +0200 |
commit | ffb28698bf5922f5d89a0d986fc6ab289fd5b6d3 (patch) | |
tree | 68ef6a79754c844a90d1d3d9c0caf3ba1be0808e /sys/src | |
parent | 4fd68773e2c5935b1b5bce0376ced783f87c7934 (diff) |
kernel: fix bounds check in screenputc()
Diffstat (limited to 'sys/src')
-rw-r--r-- | sys/src/9/bcm/screen.c | 2 | ||||
-rw-r--r-- | sys/src/9/omap/screen.c | 2 | ||||
-rw-r--r-- | sys/src/9/pc/vga.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/sys/src/9/bcm/screen.c b/sys/src/9/bcm/screen.c index a892a811d..fc0076b78 100644 --- a/sys/src/9/bcm/screen.c +++ b/sys/src/9/bcm/screen.c @@ -303,7 +303,7 @@ screenputc(char *buf) 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]) { diff --git a/sys/src/9/omap/screen.c b/sys/src/9/omap/screen.c index fe122e4eb..bc4a64b80 100644 --- a/sys/src/9/omap/screen.c +++ b/sys/src/9/omap/screen.c @@ -576,7 +576,7 @@ screenputc(char *buf) 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]) { diff --git a/sys/src/9/pc/vga.c b/sys/src/9/pc/vga.c index 6969f9e3c..fe903f0a0 100644 --- a/sys/src/9/pc/vga.c +++ b/sys/src/9/pc/vga.c @@ -53,7 +53,7 @@ vgascreenputc(VGAscr* scr, char* buf, Rectangle *flushr) 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; |