From 2a63b94313352ed62f47adbc1a0d33bfea7ca188 Mon Sep 17 00:00:00 2001 From: Petr Vorel Date: Wed, 17 May 2023 00:57:24 +0200 Subject: [PATCH] ping: Fix overflow on negative -i Restore back check for -i <= 0. Fixes: 918e824 ("ping: add support for sub-second timeouts") Closes: https://github.com/iputils/iputils/issues/465 Signed-off-by: Petr Vorel --- ping/ping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ping/ping.c b/ping/ping.c index 8f442037..27c72cad 100644 --- a/ping/ping.c +++ b/ping/ping.c @@ -436,7 +436,7 @@ main(int argc, char **argv) double optval; optval = ping_strtod(optarg, _("bad timing interval")); - if (isgreater(optval, (double)INT_MAX / 1000)) + if (islessequal(optval, 0) || isgreater(optval, (double)INT_MAX / 1000)) error(2, 0, _("bad timing interval: %s"), optarg); rts.interval = (int)(optval * 1000); rts.opt_interval = 1;