linux/drivers/usb/fotg210
Lee Jones 7d7f794482 usb: fotg210-hcd: Replace snprintf() with the safer scnprintf() variant
There is a general misunderstanding amongst engineers that {v}snprintf()
returns the length of the data *actually* encoded into the destination
array.  However, as per the C99 standard {v}snprintf() really returns
the length of the data that *would have been* written if there were
enough space for it.  This misunderstanding has led to buffer-overruns
in the past.  It's generally considered safer to use the {v}scnprintf()
variants in their place (or even sprintf() in simple cases).  So let's
do that.

The uses in this file both seem to assume that data *has been* written!

Link: https://lwn.net/Articles/69419/
Link: https://github.com/KSPP/linux/issues/105
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Yuan-Hsin Chen <yhchen@faraday-tech.com>
Cc: Feng-Hsin Chiang <john453@faraday-tech.com>
Cc: Po-Yu Chuang <ratbert.chuang@gmail.com>
Cc: linux-usb@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20231130105459.3208986-4-lee@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-04 22:25:17 +09:00
..
fotg210-core.c usb: fotg210: Convert to platform remove callback returning void 2023-05-28 12:36:25 +01:00
fotg210-hcd.c usb: fotg210-hcd: Replace snprintf() with the safer scnprintf() variant 2023-12-04 22:25:17 +09:00
fotg210-hcd.h usb: fotg210: Acquire memory resource in core 2023-01-19 14:10:43 +01:00
fotg210-udc.c Merge 6.2-rc7 into usb-next 2023-02-06 08:33:30 +01:00
fotg210-udc.h fotg210-udc: Improve device initialization 2023-01-24 18:12:18 +01:00
fotg210.h usb: fotg210-udc: Implement VBUS session 2023-01-19 14:10:44 +01:00
Kconfig usb: fotg210: fix a Kconfig spelling mistake 2023-01-25 15:43:24 +01:00
Makefile