]> git.itanic.dy.fi Git - linux-stable/commit
can: peak_usb: force the string buffer NULL-terminated
authorWang Xiayang <xywang.sjtu@sjtu.edu.cn>
Wed, 31 Jul 2019 07:25:59 +0000 (15:25 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Aug 2019 06:28:38 +0000 (08:28 +0200)
commit35d9e9211baf303037c3aae155428666b279d295
treeb85ebff73dcb267853c67d8721c51be0a9f90d67
parent895c8fcfedad2af3fe265e796afbbc43096c84a3
can: peak_usb: force the string buffer NULL-terminated

[ Upstream commit e787f19373b8a5fa24087800ed78314fd17b984a ]

strncpy() does not ensure NULL-termination when the input string size
equals to the destination buffer size IFNAMSIZ. The output string is
passed to dev_info() which relies on the NULL-termination.

Use strlcpy() instead.

This issue is identified by a Coccinelle script.

Signed-off-by: Wang Xiayang <xywang.sjtu@sjtu.edu.cn>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/can/usb/peak_usb/pcan_usb_core.c