aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/cdns3/cdns3-gadget.c
diff options
context:
space:
mode:
authorKees Cook <[email protected]>2023-11-16 19:14:52 +0000
committerGreg Kroah-Hartman <[email protected]>2023-11-22 12:02:53 +0000
commit2d1803ada2e021b9333b8a784c55fe828ab2b985 (patch)
tree00454ca48a2ac498bb77eaa87763b00099e46f59 /drivers/usb/cdns3/cdns3-gadget.c
parentusb: gadget: pxa25x_udc: Convert to platform remove callback returning void (diff)
downloadkernel-2d1803ada2e021b9333b8a784c55fe828ab2b985.tar.gz
kernel-2d1803ada2e021b9333b8a784c55fe828ab2b985.zip
usb: gadget: f_midi: Replace strlcpy() with strscpy()
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 destination string. In an effort to remove strlcpy() completely[2], replace strlcpy() here with strscpy(). In the unlikely (impossible?) case where opts->id was larger than PAGE_SIZE, this will now correctly report truncation errors. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy [1] Link: https://github.com/KSPP/linux/issues/89 [2] Cc: Greg Kroah-Hartman <[email protected]> Cc: Will McVicker <[email protected]> Cc: "Gustavo A. R. Silva" <[email protected]> Cc: Peter Chen <[email protected]> Cc: Davidlohr Bueso <[email protected]> Cc: Zhang Qilong <[email protected]> Cc: Linyu Yuan <[email protected]> Cc: John Keeping <[email protected]> Cc: Azeem Shaikh <[email protected]> Cc: [email protected] Signed-off-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'drivers/usb/cdns3/cdns3-gadget.c')
0 files changed, 0 insertions, 0 deletions