From b230117970b332138493932c7f4a3da70118c807 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 10 Mar 2014 11:57:26 +0100 Subject: [PATCH] cfdisk: update table index when out of range Signed-off-by: Karel Zak --- fdisks/cfdisk.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fdisks/cfdisk.c b/fdisks/cfdisk.c index 7865578f1c..0fd64bf61b 100644 --- a/fdisks/cfdisk.c +++ b/fdisks/cfdisk.c @@ -1052,6 +1052,9 @@ static int ui_draw_table(struct cfdisk *cf) clrtoeol(); } + if ((size_t) cf->lines_idx > nparts - 1) + cf->lines_idx = nparts ? nparts - 1 : 0; + /* print header */ attron(A_BOLD); mvaddstr(TABLE_START_LINE, cl, cf->lines[0]); -- 2.47.2