lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230613023722.GA883@sol.localdomain>
Date:   Mon, 12 Jun 2023 19:37:22 -0700
From:   Eric Biggers <ebiggers@...nel.org>
To:     Azeem Shaikh <azeemshaikh38@...il.com>
Cc:     Herbert Xu <herbert@...dor.apana.org.au>,
        "David S. Miller" <davem@...emloft.net>,
        linux-hardening@...r.kernel.org, linux-crypto@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] crypto: Replace strlcpy with strscpy

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ