[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADmuW3XKZkYB4dKPa2Bsoj96CK4hT_8cwV++7rEFP=Wxw7hGvQ@mail.gmail.com>
Date: Sun, 9 Jul 2023 22:36:44 -0400
From: Azeem Shaikh <azeemshaikh38@...il.com>
To: Kees Cook <keescook@...omium.org>
Cc: Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>,
Eric Biggers <ebiggers@...nel.org>,
linux-hardening@...r.kernel.org, linux-crypto@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] crypto: Replace strlcpy with strscpy
On Tue, Jun 20, 2023 at 4:12 PM Kees Cook <keescook@...omium.org> wrote:
>
> On Tue, Jun 20, 2023 at 08:08:32PM +0000, Azeem Shaikh wrote:
> > strlcpy() reads the entire source buffer first.
> > This read may exceed the destination size limit.
> > This is both inefficient and can lead to linear read
> > overflows if a source string is not NUL-terminated [1].
> > In an effort to remove strlcpy() completely [2], replace
> > strlcpy() here with strscpy().
> >
> > Direct replacement is safe here since return value of -errno
> > is used to check for truncation instead of sizeof(dest).
> >
> > [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy
> > [2] https://github.com/KSPP/linux/issues/89
> >
> > Signed-off-by: Azeem Shaikh <azeemshaikh38@...il.com>
>
> Thanks for fixing up the variable type. (And thank you Eric for catching
> the signedness problem!)
>
> Reviewed-by: Kees Cook <keescook@...omium.org>
>
Friendly ping on this.
Powered by blists - more mailing lists