Re: [PATCH] usb: gadget: f_midi: prefer strscpy() over strcpy()

From: Kees Cook
Date: Tue Sep 17 2024 - 04:30:42 EST


On Sun, Sep 15, 2024 at 04:47:49AM +0530, Abdul Rahim wrote:
> The function strcpy() is depreciated and potentially unsafe. It performs
> no bounds checking on the destination buffer. This could result in
> linear overflows beyond the end of the buffer, leading to all kinds of
> misbehaviors. The safe replacement is strscpy() [1].
>
> this fixes checkpatch warning:
> WARNING: Prefer strscpy over strcpy
>
> Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy [1]
> Signed-off-by: Abdul Rahim <abdul.rahim@xxxxxxxxxxx>

Yup, these look good. Thanks!

Reviewed-by: Kees Cook <kees@xxxxxxxxxx>

--
Kees Cook