Linux Hardening
 help / color / mirror / Atom feed
* Re: [PATCH linux-next] tracing: use strscpy() to instead of strncpy()
       [not found] ` <20230124121703.1e3a1ac4@gandalf.local.home>
@ 2025-02-14 22:27   ` Thorsten Blum
  0 siblings, 0 replies; only message in thread
From: Thorsten Blum @ 2025-02-14 22:27 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: yang.yang29, mhiramat, linux-kernel, linux-trace-kernel, xu.panda,
	linux-hardening, Justin Stitt

Hi Steven,

I was about to submit the same patch when I found this one from 2023.

On 24. Jan 2023, at 18:17, Steven Rostedt wrote:
> So the above will *always* return -E2BIG *and* not end buf[] with '\0' as
> if strscpy() returns -E2BIG, then buf[] is not guaranteed to be
> NUL-terminated.

The return value is not used and the strscpy() documentation in
linux/string.h says:

"The destination @dst buffer is always NUL terminated, unless it's zero-
sized." and "Preferred to strncpy() since it always returns a valid
string, ..."

Has strscpy() changed since 2023 or could this patch be revisited? I saw
that Justin also made an effort in September 2024 [1] to revisit it and
to remove the deprecated strncpy() here.

> NACK!
> 
> -- Steve

Thanks,
Thorsten

[1] https://lore.kernel.org/r/yhv3rzg6vhgwage27cyvg72t4vwf5x3tdtj3zjipryzvz3u55x@c33q753uxyi3/
Cc: linux-hardening@vger.kernel.org

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-02-14 22:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <202301091939219689840@zte.com.cn>
     [not found] ` <20230124121703.1e3a1ac4@gandalf.local.home>
2025-02-14 22:27   ` [PATCH linux-next] tracing: use strscpy() to instead of strncpy() Thorsten Blum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox