Subject: Re: [PATCH iproute2 -next] ip: route: add congestion control metric

From: Stephen Hemminger <[email-masked]>
Date: Tue, 6 Jan 2015 17:09:26 -0800

On Wed,  7 Jan 2015 00:52:37 +0100
Daniel Borkmann <[email-masked]> wrote:

> +		} else if (matches(*argv, "congctl") == 0) {
> +			char cc[16];
> +			NEXT_ARG();
> +			memset(cc, 0, sizeof(cc));
> +			if (strcmp(*argv, "lock") == 0) {
> +				mxlock |= (1<<RTAX_CC_ALGO);

Unneeded paren

> +				NEXT_ARG();
> +			}
> +			strncpy(cc, *argv, sizeof(cc) - 1);
> +			if (strlen(cc) == 0)
> +				invarg("\"conctl\" value must be an algorithm name\n", *argv

Silently truncating the string is not odd. Can't we just let kernel impose
length restrictions.