[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202307281133.16D4305@keescook>
Date: Fri, 28 Jul 2023 11:38:09 -0700
From: Kees Cook <keescook@...omium.org>
To: Elliott Mitchell <ehem+xen@....com>
Cc: Justin Stitt <justinstitt@...gle.com>,
Oleksandr Andrushchenko <oleksandr_andrushchenko@...m.com>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>, xen-devel@...ts.xenproject.org,
alsa-devel@...a-project.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ALSA: xen-front: refactor deprecated strncpy
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@...omium.org>
--
Kees Cook
Powered by blists - more mailing lists