summaryrefslogtreecommitdiffstats
path: root/fdisks/cfdisk.c
diff options
context:
space:
mode:
authorKarel Zak2014-03-10 11:57:26 +0100
committerKarel Zak2014-03-11 11:35:15 +0100
commitb230117970b332138493932c7f4a3da70118c807 (patch)
tree153ac6e4da0e5672ed61bae20f0dd2df1323048f /fdisks/cfdisk.c
parentlibfdisk: (sun) add info about whole-disk partition (diff)
downloadkernel-qcow2-util-linux-b230117970b332138493932c7f4a3da70118c807.tar.gz
kernel-qcow2-util-linux-b230117970b332138493932c7f4a3da70118c807.tar.xz
kernel-qcow2-util-linux-b230117970b332138493932c7f4a3da70118c807.zip
cfdisk: update table index when out of range
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'fdisks/cfdisk.c')
-rw-r--r--fdisks/cfdisk.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fdisks/cfdisk.c b/fdisks/cfdisk.c
index 7865578f1..0fd64bf61 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]);