[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y2pfuloLUBKZ1+IA@smile.fi.intel.com>
Date: Tue, 8 Nov 2022 15:55:06 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH v1 1/1] mac_pton: Don't access memory over expected length
On Mon, Oct 10, 2022 at 10:45:49PM +0200, Andrew Lunn wrote:
> On Mon, Oct 10, 2022 at 11:29:37PM +0300, Andy Shevchenko wrote:
> > On Mon, Oct 10, 2022 at 10:19:49PM +0200, Andrew Lunn wrote:
> > > On Wed, Oct 05, 2022 at 07:43:01PM +0300, Andy Shevchenko wrote:
> > > > The strlen() may go too far when estimating the length of
> > > > the given string. In some cases it may go over the boundary
> > > > and crash the system which is the case according to the commit
> > > > 13a55372b64e ("ARM: orion5x: Revert commit 4904dbda41c8.").
> > > >
> > > > Rectify this by switching to strnlen() for the expected
> > > > maximum length of the string.
> > >
> > > This seems like something which should have a fixes: tag, and be
> > > against net, not net-next.
> >
> > I can (re-)send it that way. Just need a consensus by net maintainers.
>
> I would probably do:
>
> if (strnlen(s, maxlen) != maxlen)
> return false;
>
> I doubt anybody is removing leading zeros in MAC addresses.
I'm not sure what this change gives us. < maxlen is more readable to understand
that we refuse anything that less than maxlen, with your change it's easy to
misinterpret it (by missing 'n' in the non-standard call) as "it must equal to
maxlen" which is obviously not true.
That said, I leave it as is.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists