From 02530a4859ce4a629f37dcb6a2773f4b6e4ac71e Mon Sep 17 00:00:00 2001 From: Nathaniel Wesley Filardo Date: Sat, 7 Nov 2015 00:38:40 -0500 Subject: [PATCH] Add sanity check panic for CRTC interactions --- console.c | 3 +++ 1 file changed, 3 insertions(+) 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);