lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 13 Oct 2023 11:20:04 +0200
From: Florian Westphal <fw@...len.de>
To: Ma Ke <make_ruc2021@....com>
Cc: jmaloy@...hat.com, ying.xue@...driver.com, davem@...emloft.net,
	edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
	netdev@...r.kernel.org, tipc-discussion@...ts.sourceforge.net,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] tipc: Fix uninit-value access in tipc_nl_node_get_link()

Ma Ke <make_ruc2021@....com> wrote:
> Names must be null-terminated strings. If a name which is not 
> null-terminated is passed through netlink, strstr() and similar 
> functions can cause buffer overrun. This patch fixes this issue 
> by returning -EINVAL if a non-null-terminated name is passed.
> 
> Signed-off-by: Ma Ke <make_ruc2021@....com>
> ---
>  net/tipc/node.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/net/tipc/node.c b/net/tipc/node.c
> index 3105abe97bb9..a02bcd7e07d3 100644
> --- a/net/tipc/node.c
> +++ b/net/tipc/node.c
> @@ -2519,6 +2519,9 @@ int tipc_nl_node_get_link(struct sk_buff *skb, struct genl_info *info)
>  		return -EINVAL;
>  
>  	name = nla_data(attrs[TIPC_NLA_LINK_NAME]);
> +	if (name[strnlen(name,
> +			 nla_len(attrs[TIPC_NLA_LINK_NAME]))] != '\0')
> +		return -EINVAL;

If the existing userspace is passing 0-terminated strings it would be
better to fix the policy (tipc_nl_link_policy) instead (and set NLA_NUL_STRING).

And if not, above change breaks userspace.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ