From: Jamie Bainbridge Date: Wed, 29 Jun 2016 23:15:33 +0000 (+1000) Subject: Don't accept zero -C or -W options X-Git-Tag: tcpdump-4.8.0~16^2 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/68a0f9980d04dc89b2fb29e5b721ad7606d9733b Don't accept zero -C or -W options Rolling over into zero filesize makes no sense. Creating a rotating buffer of zero files makes no sense. Modify the checks for -C and -W to accept greater than one, not greater than zero. Signed-off-by: Jamie Bainbridge --- diff --git a/tcpdump.c b/tcpdump.c index 1db35daa..282d44c9 100644 --- a/tcpdump.c +++ b/tcpdump.c @@ -864,7 +864,7 @@ main(int argc, char **argv) case 'C': Cflag = atoi(optarg) * 1000000; - if (Cflag < 0) + if (Cflag <= 0) error("invalid file size %s", optarg); break; @@ -1145,7 +1145,7 @@ main(int argc, char **argv) case 'W': Wflag = atoi(optarg); - if (Wflag < 0) + if (Wflag <= 0) error("invalid number of output files %s", optarg); WflagChars = getWflagChars(Wflag); break;