]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: ieee802154: adf7242: Fix some potential buffer overflow in adf7242_stats_show()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 21 Oct 2023 18:03:53 +0000 (20:03 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Nov 2023 16:26:38 +0000 (17:26 +0100)
commit6afd112c3f9553715d49fa3f2a795a559927b18f
treecdf32cefdec2d119f1f3944883e3ce2b3c9cad2c
parent46cd35e4e774ba8a948c5755ea065839ec760bb7
net: ieee802154: adf7242: Fix some potential buffer overflow in adf7242_stats_show()

[ Upstream commit ca082f019d8fbb983f03080487946da714154bae ]

strncat() usage in adf7242_debugfs_init() is wrong.
The size given to strncat() is the maximum number of bytes that can be
written, excluding the trailing NULL.

Here, the size that is passed, DNAME_INLINE_LEN, does not take into account
the size of "adf7242-" that is already in the array.

In order to fix it, use snprintf() instead.

Fixes: 7302b9d90117 ("ieee802154/adf7242: Driver for ADF7242 MAC IEEE802154")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ieee802154/adf7242.c