]> git.ozlabs.org Git - petitboot/commitdiff
ui/ncurses: specify a fixed length for status messages
authorJeremy Kerr <jk@ozlabs.org>
Mon, 5 May 2014 03:45:16 +0000 (11:45 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Wed, 16 Jul 2014 00:47:46 +0000 (08:47 +0800)
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 <jk@ozlabs.org>
ui/ncurses/nc-scr.c

index 41e35de849381a568cfb6b4f04ecfd862f23d8a4..a02627bae946b761b78484c40fd306022aaed63d 100644 (file)
@@ -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)