1 From 22d00a28c9470bd7132860930a00e1d0ee7f9df0 Mon Sep 17 00:00:00 2001
2 From: Guillem Jover <guillem@hadrons.org>
3 Date: Sat, 13 Jul 2019 22:38:53 +0200
4 Subject: [PATCH 55/60] ping6: Fix --interval to be in seconds not milliseconds
6 This was allowing unprivileged users to use ping floods by setting very
11 ping/ping6.c | 6 +++++-
12 1 file changed, 5 insertions(+), 1 deletion(-)
14 diff --git a/ping/ping6.c b/ping/ping6.c
15 index 114b9c0c..299cd56c 100644
18 @@ -75,6 +75,8 @@ int tclass = -1; /* Kernel sets default: -1, RFC 3542. */
22 +#define MIN_USER_INTERVAL (200000/PING_PRECISION)
24 static int ping_echo (char *hostname);
25 static void ping_reset (PING * p);
26 static int send_echo (PING * ping);
27 @@ -159,7 +161,9 @@ parse_opt (int key, char *arg, struct argp_state *state)
30 options |= OPT_INTERVAL;
31 - interval = ping_cvt_number (arg, 0, 0);
32 + interval = ping_cvt_number (arg, 0, 0) * PING_PRECISION;
33 + if (!is_root && interval < MIN_USER_INTERVAL)
34 + error (EXIT_FAILURE, 0, "option value too small: %s", arg);
39 2.26.0.292.g33ef6b2f38