]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
can: sja1000: force the string buffer NULL-terminated
authorWang Xiayang <xywang.sjtu@sjtu.edu.cn>
Wed, 31 Jul 2019 07:31:14 +0000 (15:31 +0800)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 4 Sep 2019 06:16:38 +0000 (02:16 -0400)
commitfffe962fe0074d334be297559ac2e4c16c1d7099
tree0d45e84d1ff9238398070e19f38da32393e26677
parentb44aa894d6faf3422e748d27be8e9149c2f24015
can: sja1000: force the string buffer NULL-terminated

BugLink: https://bugs.launchpad.net/bugs/1842114
[ Upstream commit cd28aa2e056cd1ea79fc5f24eed0ce868c6cab5c ]

strncpy() does not ensure NULL-termination when the input string size
equals to the destination buffer size IFNAMSIZ. The output string
'name' is passed to dev_info which relies on 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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/net/can/sja1000/peak_pcmcia.c