linux-stable/drivers/usb/usbip
Azeem Shaikh 61d52f64ac usbip: usbip_host: 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].
In an effort to remove strlcpy() completely [2], replace
strlcpy() here with strscpy().

Direct replacement is safe here since return value of -errno
is used to check for truncation instead of sizeof(dest).

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy
[2] https://github.com/KSPP/linux/issues/89

Signed-off-by: Azeem Shaikh <azeemshaikh38@gmail.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Acked-by: Shuah Khan <skhan@linuxfoundation.org>
Message-ID: <20230615180504.401169-1-azeemshaikh38@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-23 09:54:32 +02:00
..
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile
stub.h
stub_dev.c USB: usbip: missing lock in stub down 2022-10-22 13:22:25 +02:00
stub_main.c usbip: usbip_host: Replace strlcpy with strscpy 2023-06-23 09:54:32 +02:00
stub_rx.c usbip: add USBIP_URB_* URB transfer flags 2022-08-31 09:07:53 +02:00
stub_tx.c
usbip_common.c Treewide: Stop corrupting socket's task_frag 2022-12-19 17:28:49 -08:00
usbip_common.h Linux 5.12-rc8 2021-04-20 10:13:58 +02:00
usbip_event.c usb: Remove redundant 'flush_workqueue()' calls 2021-11-17 14:36:57 +01:00
vhci.h
vhci_hcd.c usbip: vhci_hcd: Convert to platform remove callback returning void 2023-05-28 12:38:02 +01:00
vhci_rx.c kcov, usbip: collect coverage from vhci_rx_loop 2020-12-28 15:48:36 +01:00
vhci_sysfs.c usbip: add sysfs_lock to synchronize sysfs code paths 2021-04-05 09:05:42 +02:00
vhci_tx.c usbip: Fix free of unallocated memory in vhci tx 2019-10-28 17:51:06 +01:00
vudc.h
vudc_dev.c usbip: vudc synchronize sysfs code paths 2021-04-05 09:05:42 +02:00
vudc_main.c usb: usbip: eliminate anonymous module_init & module_exit 2022-03-18 12:52:56 +01:00
vudc_rx.c usb/usbip: Fix v_recv_cmd_submit() to use PIPE_BULK define 2022-11-11 10:28:42 +01:00
vudc_sysfs.c usbip: vudc: Convert snprintf() to sysfs_emit() 2022-10-22 13:20:49 +02:00
vudc_transfer.c usbip: Use fallthrough pseudo-keyword 2020-07-09 18:06:35 +02:00
vudc_tx.c