]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
net/ethernet/qlogic/qed: force the string buffer NULL-terminated
authorWang Xiayang <xywang.sjtu@sjtu.edu.cn>
Wed, 31 Jul 2019 08:15:42 +0000 (16:15 +0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Tue, 17 Sep 2019 16:02:18 +0000 (18:02 +0200)
commit241104654993eb130f4709dbb40a5922bd45059f
tree43019878bc7d9e5e6883bc115fa8d33e2a38c19c
parent464d526041b49f7e795dbeae395bf16dab5459d1
net/ethernet/qlogic/qed: force the string buffer NULL-terminated

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

strncpy() does not ensure NULL-termination when the input string
size equals to the destination buffer size 30.
The output string is passed to qed_int_deassertion_aeu_bit()
which calls DP_INFO() and relies NULL-termination.

Use strlcpy instead. The other conditional branch above strncpy()
needs no fix as snprintf() ensures NULL-termination.

This issue is identified by a Coccinelle script.

Signed-off-by: Wang Xiayang <xywang.sjtu@sjtu.edu.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
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/ethernet/qlogic/qed/qed_int.c