From: Eric Biggers <ebiggers@kernel.org>
To: Azeem Shaikh <azeemshaikh38@gmail.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
linux-hardening@vger.kernel.org, linux-crypto@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] crypto: Replace strlcpy with strscpy
Date: Mon, 12 Jun 2023 19:37:22 -0700 [thread overview]
Message-ID: <20230613023722.GA883@sol.localdomain> (raw)
In-Reply-To: <20230613002258.3535506-1-azeemshaikh38@gmail.com>
On Tue, Jun 13, 2023 at 12:22:58AM +0000, Azeem Shaikh wrote:
> diff --git a/crypto/lrw.c b/crypto/lrw.c
> index 1b0f76ba3eb5..bb8c1575645b 100644
> --- a/crypto/lrw.c
> +++ b/crypto/lrw.c
> @@ -359,8 +359,8 @@ static int lrw_create(struct crypto_template *tmpl, struct rtattr **tb)
> if (!strncmp(cipher_name, "ecb(", 4)) {
> unsigned len;
>
> - len = strlcpy(ecb_name, cipher_name + 4, sizeof(ecb_name));
> - if (len < 2 || len >= sizeof(ecb_name))
> + len = strscpy(ecb_name, cipher_name + 4, sizeof(ecb_name));
> + if (len < 2)
> goto err_free_inst;
This is wrong because 'len' is unsigned. So the -EFBIG return value is not
being checked for, so this patch actually removes the overflow check.
It looks like you've sent over 60 strscpy conversion patches recently
(https://lore.kernel.org/linux-hardening/?q=f%3Aazeemshaikh38+s%3Astrscpy).
That's concerning because this is the only one that I happened to review, and it
introduces a bug. There are 60 others that could have this same bug. Can you
please review all your patches for this same bug?
- Eric
next prev parent reply other threads:[~2023-06-13 2:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-13 0:22 [PATCH] crypto: Replace strlcpy with strscpy Azeem Shaikh
2023-06-13 2:37 ` Eric Biggers [this message]
2023-06-13 14:26 ` Azeem Shaikh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230613023722.GA883@sol.localdomain \
--to=ebiggers@kernel.org \
--cc=azeemshaikh38@gmail.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.