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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ULxTq7SIKI8zZzvCtpIc1c4o41NFzejFbPTVQpNwBNjXjxVeJ-YOEShGUxw_uTLIYTiC0PEvER_FLWMDmD2SXc5NCpZ8wD-WxIA_RkpUzKs=@protonmail.com>
Date: Wed, 26 Mar 2025 17:05:17 +0000
From: Roxana Nicolescu <nicolescu.roxana@...tonmail.com>
To: Kent Overstreet <kent.overstreet@...ux.dev>
Cc: Alan Huang <mmpgouride@...il.com>, Bharadwaj Raju <bharadwaj.raju777@...il.com>, linux-bcachefs@...r.kernel.org, linux-kernel@...r.kernel.org, skhan@...uxfoundation.org, linux-kernel-mentees@...ts.linux.dev
Subject: Re: [PATCH] bcachefs: replace deprecated strncpy() with strscpy()

On Wednesday, March 26th, 2025 at 5:41 PM, Kent Overstreet <kent.overstreet@...ux.dev> wrote:

> On Thu, Mar 27, 2025 at 12:36:25AM +0800, Alan Huang wrote:
> 
> > On Mar 27, 2025, at 00:17, Kent Overstreet kent.overstreet@...ux.dev wrote:
> > 
> > > On Wed, Mar 26, 2025 at 09:19:06PM +0530, Bharadwaj Raju wrote:
> > > 
> > > > On Wed, Mar 26, 2025 at 8:22 PM Kent Overstreet
> > > > kent.overstreet@...ux.dev wrote:
> > > > 
> > > > > Or better, a new helper: when we're copying to a fixed size buffer we
> > > > > really want to zero out the rest of the buffer - we don't just want a
> > > > > single terminating nul.
> > > > 
> > > > I believe strscpy_pad does this?
> > > > 
> > > > https://docs.kernel.org/core-api/kernel-api.html#c.strscpy_pad
> > > 
> > > almost, we don't want the 'required nul termination'; that's a
> > > requirement at least for disk labels where we need to preserve existing
> > > behaviour
> > 
> > memcpy_and_pad :)
> 
> 
> I'll take that patch :)

I'll send a follow-up patch with memcpy_and_pad with the pad_char=0. Even though strscpy_pad does not require it, it does make the assumption that the destination buffer should be NUL-terminated, and it does some extra checks we don't need, so memcpy_and_pad is the way to go.
 
I'll also replace the memcpy calls in bch2_trans_log_msg() and __bch2_fs_log_ms().  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ