]> Devi Nivas Git - cs3210-lab1.git/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)
committerFrans Kaashoek <kaashoek@mit.edu>
Sun, 15 Nov 2015 18:28:15 +0000 (13:28 -0500)
console.c

index 766dc3086732836dc6c29a0747669ceba40753ea..46c867ba5880d2cf1eb4fb7664e99c50e2f2b087 100644 (file)
--- a/console.c
+++ b/console.c
@@ -143,6 +143,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);