Commit 8ec8041b authored by Guvenc Gulce's avatar Guvenc Gulce Committed by Litao Jiao
Browse files

net/smc: use memcpy instead of snprintf to avoid out of bounds read

mainline inclusion
from mainline-v5.11-rc4
commit 8a446536
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I78IFM
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id=8a4465368964b4fbaf084760c94c7aabf61059fb



--------------------------------

Using snprintf() to convert not null-terminated strings to null
terminated strings may cause out of bounds read in the source string.
Therefore use memcpy() and terminate the target string with a null
afterwards.

Fixes: a3db10ef ("net/smc: Add support for obtaining SMCR device list")
Signed-off-by: default avatarGuvenc Gulce <guvenc@linux.ibm.com>
Signed-off-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarYingyu Zeng <zengyingyu@sangfor.com.cn>
parent f58c7ab3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment