]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Aug 2019 06:26:40 +0000 (08:26 +0200)
commit77a6e51271f08e6b10426477afa3b4afa9bfa221
tree4614f34b412737f94079d29d8182f37f6e28fef3
parent4132b908c8fe5cbdac619911f116aec7e6fa1910
net/ethernet/qlogic/qed: force the string buffer NULL-terminated

[ 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>
drivers/net/ethernet/qlogic/qed/qed_int.c