Re: [PATCH] ALSA: xen-front: refactor deprecated strncpy

2023-07-29 Thread Takashi Iwai
On Thu, 27 Jul 2023 23:53:24 +0200, Justin Stitt wrote: > > `strncpy` is deprecated for use on NUL-terminated destination strings [1]. > > A suitable replacement is `strscpy` [2] due to the fact that it > guarantees NUL-termination on its destination buffer argument which is > _not_ always the ca

Re: [PATCH] ALSA: xen-front: refactor deprecated strncpy

2023-07-28 Thread Kees Cook
On Thu, Jul 27, 2023 at 09:46:36PM -0700, Elliott Mitchell wrote: > On Thu, Jul 27, 2023 at 09:53:24PM +, Justin Stitt wrote: > > Technically, my patch yields subtly different behavior. The original > > implementation with `strncpy` would fill the entire destination buffer > > with null bytes [

Re: [PATCH] ALSA: xen-front: refactor deprecated strncpy

2023-07-27 Thread Elliott Mitchell
On Thu, Jul 27, 2023 at 09:53:24PM +, Justin Stitt wrote: > Technically, my patch yields subtly different behavior. The original > implementation with `strncpy` would fill the entire destination buffer > with null bytes [3] while `strscpy` will leave the junk, uninitialized > bytes trailing aft

[PATCH] ALSA: xen-front: refactor deprecated strncpy

2023-07-27 Thread Justin Stitt
`strncpy` is deprecated for use on NUL-terminated destination strings [1]. A suitable replacement is `strscpy` [2] due to the fact that it guarantees NUL-termination on its destination buffer argument which is _not_ always the case for `strncpy`! It should be noted that, in this case, the destina