All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Jon Maloy <jmaloy@redhat.com>, Ying Xue <ying.xue@windriver.com>,
	Per Liden <per.liden@nospam.ericsson.com>,
	netdev@vger.kernel.org, tipc-discussion@lists.sourceforge.net
Subject: Re: [PATCH net-next v2] tipc: guard against string buffer overrun
Date: Fri, 2 Aug 2024 10:42:19 +0100	[thread overview]
Message-ID: <20240802094219.GB2503418@kernel.org> (raw)
In-Reply-To: <20240801-tipic-overrun-v2-1-c5b869d1f074@kernel.org>

On Thu, Aug 01, 2024 at 07:35:37PM +0100, Simon Horman wrote:
> Smatch reports that copying media_name and if_name to name_parts may
> overwrite the destination.
> 
>  .../bearer.c:166 bearer_name_validate() error: strcpy() 'media_name' too large for 'name_parts->media_name' (32 vs 16)
>  .../bearer.c:167 bearer_name_validate() error: strcpy() 'if_name' too large for 'name_parts->if_name' (1010102 vs 16)
> 
> This does seem to be the case so guard against this possibility by using
> strscpy() and failing if truncation occurs.
> 
> Introduced by commit b97bf3fd8f6a ("[TIPC] Initial merge")
> 
> Compile tested only.
> 
> Reviewed-by: Jakub Kicinski <kuba@kernel.org>
> Signed-off-by: Simon Horman <horms@kernel.org>
> ---
> I am not marking this as a fix for net as I am not aware of this
> actually breaking anything in practice. Thus, at this point I consider
> it more of a clean-up than a bug fix.
> ---
> Changes in v2:
> - Correct formatting and typo in subject (Thanks Jakub)
>   + The formatting problem was caused by tooling (b4)
>     so I reworded the subject as a work-around

Just to clarify. The formatting issue I was referring, is a double space
in the subject [1], which seems to of occurred due to the subject being
linewrapped and then unlinewrapped. However, in the light of a new day,
it is not at all clear to me that b4 is the cause of the problem.
So sorry for pointing my finger at it.

[1] https://lore.kernel.org/netdev/20240731182356.01a4c2b8@kernel.org/

> - Added Acked-by tag from Jakub
> - Link to v1: https://lore.kernel.org/r/20240731-tipic-overrun-v1-1-32ce5098c3e9@kernel.org

...

  reply	other threads:[~2024-08-02  9:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-01 18:35 [PATCH net-next v2] tipc: guard against string buffer overrun Simon Horman
2024-08-02  9:42 ` Simon Horman [this message]
2024-08-03  0:30 ` patchwork-bot+netdevbpf

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=20240802094219.GB2503418@kernel.org \
    --to=horms@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jmaloy@redhat.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=per.liden@nospam.ericsson.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.