[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zv-w3rXt1OLnAbX6@shell.armlinux.org.uk>
Date: Fri, 4 Oct 2024 10:09:50 +0100
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@...il.com>
Cc: linux-arm-kernel@...ts.infradead.org, linux-hardening@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] [next] ARM: Replace snprintf() with the safer
scnprintf() variant
On Fri, Oct 04, 2024 at 03:59:30PM +1300, Paulo Miguel Almeida wrote:
> There is a general misunderstanding amongst engineers that {v}snprintf()
> returns the length of the data *actually* encoded into the destination
> array. However, as per the C99 standard {v}snprintf() really returns
> the length of the data that *would have been* written if there were
> enough space for it. This misunderstanding has led to buffer-overruns
> in the past. It's generally considered safer to use the {v}scnprintf()
> variants in their place (or even sprintf() in simple cases).
So, basically, it's unsafe to use the result of (v)snprintf(). So why
do we need to change locations that do not use the result?
This patch is mere noise. Sorry, I won't be applying it.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists