]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
cfdisk: fix possible integer overflow [coverity scan]
authorKarel Zak <kzak@redhat.com>
Mon, 24 Jun 2024 07:46:37 +0000 (09:46 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 24 Jun 2024 07:46:37 +0000 (09:46 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
disk-utils/cfdisk.c

index 7b61929614cfa61e5c9ce51cc78358217a6e7060..2e0aada474a5a019d3f95cbb7edaac3c07b8e46b 100644 (file)
@@ -1733,6 +1733,8 @@ static int ui_table_goto(struct cfdisk *cf, int where)
 
        if (where < 0)
                where = 0;
+       if (!nparts)
+               where = 0;
        else if ((size_t) where > nparts - 1)
                where = nparts - 1;