Skip to content

Commit

Permalink
ping: Fix overflow on negative -i
Browse files Browse the repository at this point in the history
Restore back check for -i <= 0.

Fixes: 918e824 ("ping: add support for sub-second timeouts")
Closes: iputils#465
Signed-off-by: Petr Vorel <pvorel@suse.cz>
  • Loading branch information
pevik committed May 17, 2023
1 parent c9ad9e1 commit 2a63b94
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ping/ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2a63b94

Please sign in to comment.