Re: [PATCH] samples: Replace strlcpy() with strscpy()

2023-11-30 Thread Kees Cook
On Thu, 16 Nov 2023 11:15:10 -0800, Kees Cook wrote: > strlcpy() reads the entire source buffer first. This read may exceed > the destination size limit. This is both inefficient and can lead > to linear read overflows if a source string is not NUL-terminated[1]. > Additionally, it returns the size

Re: [PATCH] samples: Replace strlcpy() with strscpy()

2023-11-17 Thread Steven Rostedt
On Thu, 16 Nov 2023 11:15:10 -0800 Kees Cook wrote: > diff --git a/samples/trace_events/trace-events-sample.h > b/samples/trace_events/trace-events-sample.h > index 1c6b843b8c4e..23f923ccd529 100644 > --- a/samples/trace_events/trace-events-sample.h > +++ b/samples/trace_events/trace-events-samp

[PATCH] samples: Replace strlcpy() with strscpy()

2023-11-16 Thread Kees Cook
strlcpy() reads the entire source buffer first. This read may exceed the destination size limit. This is both inefficient and can lead to linear read overflows if a source string is not NUL-terminated[1]. Additionally, it returns the size of the source string, not the resulting size of the destinat