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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250327162325.GA30844@breakpoint.cc>
Date: Thu, 27 Mar 2025 17:23:25 +0100
From: Florian Westphal <fw@...len.de>
To: I Hsin Cheng <richard120310@...il.com>
Cc: jhs@...atatu.com, xiyou.wangcong@...il.com, jiri@...nulli.us,
	davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
	pabeni@...hat.com, horms@...nel.org, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org, skhan@...uxfoundation.org,
	linux-kernel-mentees@...ts.linux.dev
Subject: Re: [RFC PATCH] net: sched: em_text: Replace strncpy() with
 strscpy_pad()

I Hsin Cheng <richard120310@...il.com> wrote:
> The content within "conf.algo" should be a valid NULL-terminated string,
> however "strncpy()" doesn't guarantee that. Use strscpy_pad() to replace
> it to make sure "conf.algo" is NULL-terminated. ( trailing NULL-padding
> if source buffer is shorter. )
>
> Link: https://github.com/KSPP/linux/issues/90
> Signed-off-by: I Hsin Cheng <richard120310@...il.com>
> ---
>  net/sched/em_text.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/sched/em_text.c b/net/sched/em_text.c
> index 420c66203b17..c78b82931dc4 100644
> --- a/net/sched/em_text.c
> +++ b/net/sched/em_text.c
> @@ -108,7 +108,7 @@ static int em_text_dump(struct sk_buff *skb, struct tcf_ematch *m)
>  	struct text_match *tm = EM_TEXT_PRIV(m);
>  	struct tcf_em_text conf;
>  
> -	strncpy(conf.algo, tm->config->ops->name, sizeof(conf.algo) - 1);
> +	strscpy_pad(conf.algo, tm->config->ops->name, sizeof(conf.algo) - 1);

Please drop the 3rd argument and then resend with a fixes tag:
Fixes: d675c989ed2d ("[PKT_SCHED]: Packet classification based on textsearch (ematch)")

As is, the last byte remains uninitialised.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ