Browse Source

clang: fix longstanding bug in vga.c with incorrect index

They used sizeof instead of nelem()-1

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Ronald G. Minnich 8 years ago
parent
commit
cfee447cb9
1 changed files with 1 additions and 1 deletions
  1. 1 1
      sys/src/9/amd64/vga.c

+ 1 - 1
sys/src/9/amd64/vga.c

@@ -79,7 +79,7 @@ vgascreenputc(VGAscr* scr, char* buf, Rectangle *flushr)
 	Rectangle r;
 
 //	drawdebug = 1;
-	if(xp < xbuf || xp >= &xbuf[sizeof(xbuf)/sizeof(buf[0])])
+	if(xp < xbuf || xp >= &xbuf[nelem(xbuf)-1])
 		xp = xbuf;
 
 	h = scr->memdefont->height;