[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4ff913b9-93b3-4636-b0f6-6e874f813d2f@stanley.mountain>
Date: Thu, 14 Nov 2024 12:57:29 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Vincent Mailhol <mailhol.vincent@...adoo.fr>
Cc: Max Staudt <max@...as.org>, Marc Kleine-Budde <mkl@...gutronix.de>,
Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
linux-can@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH net] can: can327: fix snprintf() limit in
can327_handle_prompt()
On Thu, Nov 14, 2024 at 06:34:49PM +0900, Vincent Mailhol wrote:
> Hi Dan,
>
> On 14/11/2024 at 18:03, Dan Carpenter wrote:
> > This code is printing hex values to the &local_txbuf buffer and it's
> > using the snprintf() function to try prevent buffer overflows. The
> > problem is that it's not passing the correct limit to the snprintf()
> > function so the limit doesn't do anything. On each iteration we print
> > two digits so the remaining size should also decrease by two, but
> > instead it passes the sizeof() the entire buffer each time.
> >
> > If the frame->len were too long it would result in a buffer overflow.
>
> But, can frame->len be too long? Classical CAN frame maximum length is 8
> bytes. And I do not see a path for a malformed frame to reach this part of
> the driver.
>
> If such a path exists, I think this should be explained. Else, I am just not
> sure if this needs a Fixes: tag.
>
Even when bugs don't affect runtime we still assign a Fixes tag, but we don't
CC stable. There is no way that passing the wrong size was intentional.
regards,
dan carpenter
Powered by blists - more mailing lists