On Thu, Jul 27, 2023 at 09:46:36PM -0700, Elliott Mitchell wrote:
On Thu, Jul 27, 2023 at 09:53:24PM +0000, 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 after the _mandatory_ NUL-termination. So, if somehow `pcm->name` or `card->driver/shortname/longname` require this NUL-padding behavior then `strscpy_pad` should be used. My interpretation, though, is that the aforementioned fields are just fine as NUL-terminated strings. Please correct my assumptions if needed and I'll send in a v2.
"uninitialized bytes" => "leak of sensitive information" => "security hole"
For xen_snd_front_alsa_init(), "card" is already zero-initialized in snd_card_new().
For new_pcm_instance(), "pcm" is already zero-initialized in _snd_pcm_new().
So things look good to me!
Reviewed-by: Kees Cook keescook@chromium.org