tbf computes the limit from "latency" in double and stores it unchecked, so "latency 35s" at 1gbit wraps past UINT_MAX. Refuse it instead. Fixes: aba5acdfdb34 ("(Logical change 1.3)") Signed-off-by: Andrii Tereshchenko --- tbf latency 35s at 1gbit: was limit 80042944, now limit out of range. tc/q_tbf.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tc/q_tbf.c b/tc/q_tbf.c index cbe11025..60c0b6d5 100644 --- a/tc/q_tbf.c +++ b/tc/q_tbf.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "utils.h" #include "tc_util.h" @@ -208,6 +209,10 @@ static int tbf_parse_opt(const struct qdisc_util *qu, int argc, char **argv, if (lim2 < lim) lim = lim2; } + if (lim >= (double)UINT_MAX + 1) { + fprintf(stderr, "tbf: limit out of range\n"); + return -ERANGE; + } opt.limit = lim; } base-commit: 06b62d179bbb5b62cba965dcda48a613dbc59416 -- 2.53.0