From: Theodore Ts'o Date: Mon, 26 May 2025 16:36:07 +0000 (-0400) Subject: e2freefrag: require that the chunksize must be greater than 0 X-Git-Tag: v1.47.3-rc1~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3e059df08de94abde1ddd82008d0658584a35e5e;p=thirdparty%2Fe2fsprogs.git e2freefrag: require that the chunksize must be greater than 0 "e2freefrag -c 0" doesn't make much sense, so abort with an error message if the user specifies a zero chunksize. Addresses-Coverity-Bug: 1633767 Signed-off-by: Theodore Ts'o --- diff --git a/misc/e2freefrag.c b/misc/e2freefrag.c index d5d2df42..437f011f 100644 --- a/misc/e2freefrag.c +++ b/misc/e2freefrag.c @@ -393,7 +393,7 @@ int main(int argc, char *argv[]) switch (c) { case 'c': chunk_info.chunkbytes = strtoull(optarg, &end, 0); - if (*end != '\0') { + if (*end != '\0' || chunk_info.chunkbytes == 0) { fprintf(stderr, "%s: bad chunk size '%s'\n", progname, optarg); usage(progname);