wlcore: Fix buffer overrun by snprintf due to incorrect buffer size
stable inclusion from stable-5.10.37 commit b6b894e7a27e52a9032a7eaace538538830d4b9e bugzilla: 51868 CVE: NA -------------------------------- [ Upstream commit a9a4c080 ] The size of the buffer than can be written to is currently incorrect, it is always the size of the entire buffer even though the snprintf is writing as position pos into the buffer. Fix this by setting the buffer size to be the number of bytes left in the buffer, namely sizeof(buf) - pos. Addresses-Coverity: ("Out-of-bounds access") Fixes: 7b0e2c4f ("wlcore: fix overlapping snprintf arguments in debugfs") Signed-off-by: NColin Ian King <colin.king@canonical.com> Reviewed-by: NArnd Bergmann <arnd@arndb.de> Signed-off-by: NKalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20210419141405.180582-1-colin.king@canonical.comSigned-off-by: NSasha Levin <sashal@kernel.org> Signed-off-by: NChen Jun <chenjun102@huawei.com> Acked-by: NWeilong Chen <chenweilong@huawei.com> Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Showing
想要评论请 注册 或 登录