[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250725134224.0a2da8e7@kernel.org>
Date: Fri, 25 Jul 2025 13:42:24 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Breno Leitao <leitao@...ian.org>
Cc: "David S. Miller" <davem@...emloft.net>, Eric Dumazet
<edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Simon Horman
<horms@...nel.org>, Andrew Lunn <andrew+netdev@...n.ch>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org, kernel-team@...a.com
Subject: Re: [PATCH net-next v3 3/5] netconsole: add support for strings
with new line in netpoll_parse_ip_addr
On Wed, 23 Jul 2025 10:20:31 -0700 Breno Leitao wrote:
> const char *end;
> + int len;
>
> - if (!strchr(str, ':') &&
> - in4_pton(str, -1, (void *)addr, -1, &end) > 0) {
> - if (!*end)
> - return 0;
> - }
> - if (in6_pton(str, -1, addr->in6.s6_addr, -1, &end) > 0) {
> -#if IS_ENABLED(CONFIG_IPV6)
> - if (!*end)
> - return 1;
> -#else
> + len = strlen(str);
> + if (!len)
> return -1;
> -#endif
> - }
> +
> + if (str[len - 1] == '\n')
> + len -= 1;
> +
> + if (in4_pton(str, len, (void *)addr, -1, &end) > 0)
> + return 0;
> + if (IS_ENABLED(CONFIG_IPV6) &&
> + in6_pton(str, len, addr->in6.s6_addr, -1, &end) > 0)
> + return 1;
> return -1;
Looks like we're removing the validation for reaching the end of
the buffer? This should at least be explained in the commit message.
AFAICT for IPv4 for example 1.2.3.4:xyz would have been rejected,
now it's accepted. Personally I find the
if (*end && *end != '\n')
removed by subsequent patch cleaner than modifying the input string.
I'll apply the first patch of the series..
Powered by blists - more mailing lists