]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
net/smc: use memcpy instead of snprintf to avoid out of bounds read
authorGuvenc Gulce <guvenc@linux.ibm.com>
Tue, 12 Jan 2021 16:21:22 +0000 (17:21 +0100)
committerJakub Kicinski <kuba@kernel.org>
Wed, 13 Jan 2021 04:22:01 +0000 (20:22 -0800)
commit8a4465368964b4fbaf084760c94c7aabf61059fb
tree06a00842a100de9d64eaac60c872e98a060714db
parent25fe2c9c4cd2e97c5f5b69f3aefe69aad3057936
net/smc: use memcpy instead of snprintf to avoid out of bounds read

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: a3db10efcc4c ("net/smc: Add support for obtaining SMCR device list")
Signed-off-by: Guvenc Gulce <guvenc@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/smc/smc_core.c
net/smc/smc_ib.c
net/smc/smc_ism.c