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: <20250514162857.4a3f846a@gandalf.local.home>
Date: Wed, 14 May 2025 16:28:57 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Devaansh Kumar <devaanshk840@...il.com>
Cc: mhiramat@...nel.org, mathieu.desnoyers@...icios.com,
 linux-trace-kernel@...r.kernel.org, linux-kernel@...r.kernel.org,
 skhan@...uxfoundation.org, linux-kernel-mentees@...ts.linuxfoundation.org
Subject: Re: [PATCH] tracing: Replace deprecated strncpy() with strscpy()
 for string keys in hist triggers

On Thu, 15 May 2025 01:49:55 +0530
Devaansh Kumar <devaanshk840@...il.com> wrote:

> strncpy() is deprecated for NUL-terminated destination buffers and must
> be replaced by strscpy().
> 
> See issue: https://github.com/KSPP/linux/issues/90
> 
> Signed-off-by: Devaansh Kumar <devaanshk840@...il.com>
> ---
>  kernel/trace/trace_events_hist.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
> index 1260c23cfa5f..90a4e486fba8 100644
> --- a/kernel/trace/trace_events_hist.c
> +++ b/kernel/trace/trace_events_hist.c
> @@ -5225,7 +5225,7 @@ static inline void add_to_key(char *compound_key, void *key,
>  		if (size > key_field->size - 1)
>  			size = key_field->size - 1;
>  
> -		strncpy(compound_key + key_field->offset, (char *)key, size);
> +		strscpy(compound_key + key_field->offset, (char *)key, size);
>  	} else
>  		memcpy(compound_key + key_field->offset, key, size);
>  }

Incorrect, and this is already fixed in next (at least it's in my ftrace/for-next branch).

  https://lore.kernel.org/20250403210637.1c477d4a@gandalf.local.home

-- Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ