kernel: fix bounds check in screenputc()

This commit is contained in:
cinap_lenrek 2017-07-20 21:03:00 +02:00
parent 4fd68773e2
commit ffb28698bf
3 changed files with 3 additions and 3 deletions

View file

@ -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]) {

View file

@ -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]) {

View file

@ -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;