From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O49uj-0005ee-Ne for qemu-devel@nongnu.org; Tue, 20 Apr 2010 05:38:41 -0400 Received: from [140.186.70.92] (port=55347 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O49ui-0005eS-06 for qemu-devel@nongnu.org; Tue, 20 Apr 2010 05:38:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O49ug-0004yR-FI for qemu-devel@nongnu.org; Tue, 20 Apr 2010 05:38:39 -0400 Received: from os.inf.tu-dresden.de ([141.76.48.99]:40323) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O49ug-0004xs-8F for qemu-devel@nongnu.org; Tue, 20 Apr 2010 05:38:38 -0400 Received: from erwin.inf.tu-dresden.de ([141.76.48.80] helo=chrom.inf.tu-dresden.de) by os.inf.tu-dresden.de with esmtps (TLSv1:AES256-SHA:256) (Exim 4.71) id 1O49ud-00038c-QI for qemu-devel@nongnu.org; Tue, 20 Apr 2010 11:38:35 +0200 Received: from kauer by chrom.inf.tu-dresden.de with local (Exim 4.71) (envelope-from ) id 1O49ud-0004Hw-JG for qemu-devel@nongnu.org; Tue, 20 Apr 2010 11:38:35 +0200 Date: Tue, 20 Apr 2010 11:38:35 +0200 From: Bernhard Kauer Message-ID: <20100420093835.GC9079@chrom.inf.tu-dresden.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] fix curses update List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org If a terminal is resized or the VGA model issues a full refresh, curses_update() is called, which uses mvwaddchnstr() to draw a full line of characters. Unfortunatelly this routine expects a null-terminated string and early aborts if a null is present in the line. When booting an OS that zeros the VGA text buffer and later pokes single characters, the console output can become unreadable. The attached patch corrects this bug. Bernhard Kauer Signed-off-by: Bernhard Kauer diff --git a/curses.c b/curses.c index ed3165e..9bf9265 100644 --- a/curses.c +++ b/curses.c @@ -48,10 +48,12 @@ static int px, py, sminx, sminy, smaxx, smaxy; static void curses_update(DisplayState *ds, int x, int y, int w, int h) { chtype *line; + int i; line = ((chtype *) screen) + y * width; for (h += y; y < h; y ++, line += width) - mvwaddchnstr(screenpad, y, 0, line, width); + for (i = 0; i < width; i++) + mvwaddch(screenpad, y, i, (line[i] & 0xff) ? line[i] : ' '); pnoutrefresh(screenpad, py, px, sminy, sminx, smaxy - 1, smaxx - 1); refresh();