]> hydra-www.ietfng.org Git - xv6-public/commitdiff
Add sanity check panic for CRTC interactions
authorNathaniel Wesley Filardo <nwf@cs.jhu.edu>
Sat, 7 Nov 2015 05:38:40 +0000 (00:38 -0500)
committerNathaniel Wesley Filardo <nwf@cs.jhu.edu>
Wed, 11 Nov 2015 04:42:27 +0000 (23:42 -0500)
console.c

index a017e3aa023aac66080066df60ceb254089eccc6..f11abf3bf864da4985d6994f37ea8f1e5dcded28 100644 (file)
--- a/console.c
+++ b/console.c
@@ -149,6 +149,9 @@ cgaputc(int c)
     if(pos > 0) --pos;
   } else
     crt[pos++] = (c&0xff) | 0x0700;  // black on white
+
+  if(pos > 25*80)
+    panic("pos overflow");
   
   if((pos/80) >= 24){  // Scroll up.
     memmove(crt, crt+80, sizeof(crt[0])*23*80);