RE: [PATCH] xfs: replace deprecated strncpy with strscpy_pad

2024-04-15 Thread David Laight
From: Kees Cook > Sent: 11 April 2024 16:32 > > On Wed, Apr 10, 2024 at 01:45:21PM -0700, Justin Stitt wrote: > > On Tue, Apr 9, 2024 at 9:22 AM Kees Cook wrote: > > > > > > > > - /* 1 larger than sb_fname, so this ensures a trailing NUL char */ > > > > - memset(label, 0, sizeof(label));

Re: [PATCH] xfs: replace deprecated strncpy with strscpy_pad

2024-04-11 Thread Kees Cook
On Wed, Apr 10, 2024 at 01:45:21PM -0700, Justin Stitt wrote: > On Tue, Apr 9, 2024 at 9:22 AM Kees Cook wrote: > > > > > > - /* 1 larger than sb_fname, so this ensures a trailing NUL char */ > > > - memset(label, 0, sizeof(label)); > > > spin_lock(&mp->m_sb_lock); > > > - strncp

Re: [PATCH] xfs: replace deprecated strncpy with strscpy_pad

2024-04-10 Thread Justin Stitt
On Tue, Apr 9, 2024 at 9:22 AM Kees Cook wrote: > > > > - /* 1 larger than sb_fname, so this ensures a trailing NUL char */ > > - memset(label, 0, sizeof(label)); > > spin_lock(&mp->m_sb_lock); > > - strncpy(label, sbp->sb_fname, XFSLABEL_MAX); > > + strscpy_pad(label, sbp->s

Re: [PATCH] xfs: replace deprecated strncpy with strscpy_pad

2024-04-09 Thread Kees Cook
On Fri, Apr 05, 2024 at 07:52:27PM +, Justin Stitt wrote: > strncpy() is deprecated for use on NUL-terminated destination strings > [1] and as such we should prefer more robust and less ambiguous string > interfaces. > > The current code has taken care of NUL-termination by memset()'ing > @lab

[PATCH] xfs: replace deprecated strncpy with strscpy_pad

2024-04-05 Thread Justin Stitt
strncpy() is deprecated for use on NUL-terminated destination strings [1] and as such we should prefer more robust and less ambiguous string interfaces. The current code has taken care of NUL-termination by memset()'ing @label. This is followed by a strncpy() to perform the string copy. Instead,