]> git.baikalelectronics.ru Git - 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)
commit12950765bc1269bbdc502f354255d5415ed96154
tree06a00842a100de9d64eaac60c872e98a060714db
parent7b24a2bd74b81926d4a1ddc62d4ff106475ac819
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: cc3a1695c6e2 ("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