Messages in this thread | | | Date | Mon, 30 Oct 2023 15:29:00 +0300 | From | Dan Carpenter <> | Subject | Re: [PATCH v2 1/2] Staging: rts5208: Replace strncpy() with strscpy() |
| |
On Mon, Oct 30, 2023 at 02:59:34PM +0300, Nancy Nyambura wrote: > warning found by checkpatch.pl script.I replaced the usage of strncpy() > with strscpy() in the code(line 524) for the buf buffer to improve > string copying.This is appropriate since strscpy() is used when you want > to copy a NUL-terminated string and the destination buffer requires > trailing NUL-padding. > > Signed-off-by: Nancy Nyambura <nicymimz@gmail.com> > --- > Changes in v2: > - Make the commit message more clearer.
Hi Nancy,
Your commit message does not explain why you used strscpy() instead of strscpy_pad(). I have written a blog that might be helpful.
https://staticthinking.wordpress.com/2023/10/30/strcpy-strncpy-strlcpy-and-strscpy/
regards, dan carpenter
| |