]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
cfdisk: update table index when out of range
authorKarel Zak <kzak@redhat.com>
Mon, 10 Mar 2014 10:57:26 +0000 (11:57 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 11 Mar 2014 10:35:15 +0000 (11:35 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
fdisks/cfdisk.c

index 7865578f1c22a1b118f0b71707bbe0e004a29aaa..0fd64bf61b48a329f56bc7899b58e953709640e5 100644 (file)
@@ -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]);