recipes: networking/ineutils: Apply patches from Debian in order to refresh this...
[dragora.git] / patches / inetutils / 0055-ping6-Fix-interval-to-be-in-seconds-not-milliseconds.patch
blobbad24ccb9934c7137e2a0f7e6c3e54ad3036489d
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
7 low values.
9 Closes: #926750
10 ---
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
16 --- a/ping/ping6.c
17 +++ b/ping/ping6.c
18 @@ -75,6 +75,8 @@ int tclass = -1; /* Kernel sets default: -1, RFC 3542. */
19 int flowinfo;
20 #endif
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)
29 case 'i':
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);
35 break;
37 case 'l':
38 --
39 2.26.0.292.g33ef6b2f38