summaryrefslogtreecommitdiff
path: root/console.c
diff options
context:
space:
mode:
authorNathaniel Wesley Filardo <[email protected]>2015-11-07 00:38:40 -0500
committerFrans Kaashoek <[email protected]>2015-11-15 13:28:15 -0500
commit02530a4859ce4a629f37dcb6a2773f4b6e4ac71e (patch)
tree3393fa10bd6134f48215f1a0870166f1d778ce9b /console.c
parentb019ac4f7d6b440a965cf9f5efa6cdc21e66b618 (diff)
downloadxv6-labs-02530a4859ce4a629f37dcb6a2773f4b6e4ac71e.tar.gz
xv6-labs-02530a4859ce4a629f37dcb6a2773f4b6e4ac71e.tar.bz2
xv6-labs-02530a4859ce4a629f37dcb6a2773f4b6e4ac71e.zip
Add sanity check panic for CRTC interactions
Diffstat (limited to 'console.c')
-rw-r--r--console.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/console.c b/console.c
index 766dc30..46c867b 100644
--- 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);