From: Florian Westphal <fw@strlen.de>
To: Ma Ke <make_ruc2021@163.com>
Cc: jmaloy@redhat.com, ying.xue@windriver.com, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
netdev@vger.kernel.org, tipc-discussion@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tipc: Fix uninit-value access in tipc_nl_node_get_link()
Date: Fri, 13 Oct 2023 11:20:04 +0200 [thread overview]
Message-ID: <20231013092004.GA4980@breakpoint.cc> (raw)
In-Reply-To: <20231013070408.1979343-1-make_ruc2021@163.com>
Ma Ke <make_ruc2021@163.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@163.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.
next prev parent reply other threads:[~2023-10-13 9:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-13 7:04 [PATCH] tipc: Fix uninit-value access in tipc_nl_node_get_link() Ma Ke
2023-10-13 8:56 ` Vadim Fedorenko
2023-10-13 9:20 ` Florian Westphal [this message]
2023-10-14 0:17 ` Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231013092004.GA4980@breakpoint.cc \
--to=fw@strlen.de \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jmaloy@redhat.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=make_ruc2021@163.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=tipc-discussion@lists.sourceforge.net \
--cc=ying.xue@windriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.