lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZwA38C2qBDYkm7ce@mail.google.com>
Date: Sat, 5 Oct 2024 07:46:08 +1300
From: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@...il.com>
To: "Russell King (Oracle)" <linux@...linux.org.uk>
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 10:09:50AM +0100, Russell King (Oracle) wrote:
> 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.
> 
Thanks for taking the time to review this patch.

My take on this is that it boils down to nipping it in the bud proactively,
so if the result starts being used, no one has to remember to change from
scprint() to scnprint(), which can be easy to miss.

There have been other instances where the result wasn't being used, yet the
patch was still accepted [1] — should that help sway your opinion. :)

I understand that each maintainer has different approaches to what they deem
trivial patches, but I hope you reconsider accepting this one. That said, 
if there is no utilization of snprint(), we could eventually deprecate or
remove the function altogether.

[1] https://lore.kernel.org/lkml/20231213164246.1021885-11-lee@kernel.org/

Paulo A.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ