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] [day] [month] [year] [list]
Message-ID: <Z8A4kVKXXgy5KskY@alpha.franken.de>
Date: Thu, 27 Feb 2025 11:04:01 +0100
From: Thomas Bogendoerfer <tsbogend@...ha.franken.de>
To: Thorsten Blum <thorsten.blum@...ux.dev>
Cc: Jiaxun Yang <jiaxun.yang@...goat.com>, linux-hardening@...r.kernel.org,
	linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH]  MIPS: Loongson2ef: Replace deprecated strncpy() with
 strscpy()

On Mon, Feb 24, 2025 at 10:54:50PM +0100, Thorsten Blum wrote:
> strncpy() is deprecated for NUL-terminated destination buffers. Use
> strscpy() instead and remove the manual NUL-termination.
> 
> Compile-tested only.
> 
> Link: https://github.com/KSPP/linux/issues/90
> Cc: linux-hardening@...r.kernel.org
> Signed-off-by: Thorsten Blum <thorsten.blum@...ux.dev>
> ---
>  arch/mips/loongson2ef/common/machtype.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/mips/loongson2ef/common/machtype.c b/arch/mips/loongson2ef/common/machtype.c
> index 82f6de49f20f..e635e66d2e6c 100644
> --- a/arch/mips/loongson2ef/common/machtype.c
> +++ b/arch/mips/loongson2ef/common/machtype.c
> @@ -48,8 +48,7 @@ void __init prom_init_machtype(void)
>  		return;
>  	}
>  	p += strlen("machtype=");
> -	strncpy(str, p, MACHTYPE_LEN);
> -	str[MACHTYPE_LEN] = '\0';
> +	strscpy(str, p);
>  	p = strstr(str, " ");
>  	if (p)
>  		*p = '\0';
> -- 
> 2.48.1

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ