From c83eacc524ffd0cc3e93a2b88ea69e98c04859ec Mon Sep 17 00:00:00 2001 From: David Phillips Date: Sun, 12 Feb 2017 21:01:36 +1300 Subject: Disallow negative sizes and iteration limits Previously, we only checked for these valuse being zero, but not negative. --- fractal-gen.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'fractal-gen.c') diff --git a/fractal-gen.c b/fractal-gen.c index 091f7d5..bfe151d 100644 --- a/fractal-gen.c +++ b/fractal-gen.c @@ -69,8 +69,8 @@ void die_help() int main(int argc, char **argv) { - unsigned int size = 0; - unsigned int iterations = 0; + long size = 0; + long iterations = 0; char c = '\0'; while ((c = getopt(argc, argv, "s:i:")) != -1) { @@ -88,7 +88,7 @@ int main(int argc, char **argv) } } - if (size == 0 || iterations == 0) { + if (size <= 0 || iterations <= 0) { die_help(); return 1; /* mostly unreachable */ } -- cgit v1.1