Subject: Re: [PATCH iproute2 1/1] actions: Add support for user cookies

From: Stephen Hemminger <[email-masked]>
Date: Thu, 23 Nov 2017 13:09:30 -0800

On Sat, 22 Apr 2017 08:36:23 -0400
Jamal Hadi Salim <[email-masked]> wrote:

> +
> +			if (*argv && strcmp(*argv, "cookie") == 0) {
> +				size_t slen;
> +
> +				NEXT_ARG();
> +				slen = strlen(*argv);
> +				if (slen > TC_COOKIE_MAX_SIZE * 2) {
> +					char cookie_err_m[128];
> +
> +					snprintf(cookie_err_m, 128,
> +						 "%zd Max allowed size %d",
> +						 slen, TC_COOKIE_MAX_SIZE*2);
> +					invarg(cookie_err_m, *argv);

Don't bother going to effort of building a string for invarg(). Instead either
just print invalid cookie or use fprintf.

Also, what if kernel limits change?