From: Jeremy Kerr Date: Mon, 5 May 2014 03:45:16 +0000 (+0800) Subject: ui/ncurses: specify a fixed length for status messages X-Git-Tag: v1.0.0~166 X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=commitdiff_plain;h=71f338ca02092cb75608a511d6885affaf7adb66;hp=49367fdd5034a010a3f7f657f8ad205ebf9a01fe ui/ncurses: specify a fixed length for status messages Incoming status messages can be an arbitrary length; if so, the status line may be corrupt. This change uses the 'n' variant of mvwaddnstr(), so we only write one line of characters. Signed-off-by: Jeremy Kerr --- diff --git a/ui/ncurses/nc-scr.c b/ui/ncurses/nc-scr.c index 41e35de..a02627b 100644 --- a/ui/ncurses/nc-scr.c +++ b/ui/ncurses/nc-scr.c @@ -36,8 +36,8 @@ static void nc_scr_status_clear(struct nc_scr *scr) static void nc_scr_status_draw(struct nc_scr *scr) { - mvwaddstr(scr->main_ncw, LINES - nc_scr_pos_status, 1, - scr->frame.status); + mvwaddnstr(scr->main_ncw, LINES - nc_scr_pos_status, 1, + scr->frame.status, COLS); } int nc_scr_post(struct nc_scr *scr)