diff options
author | Bui Quang Minh <minhquangbui99@gmail.com> | 2024-04-24 17:44:20 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-06-12 12:11:49 +0300 |
commit | 204714e68015d6946279719fd464ecaf57240f35 (patch) | |
tree | c588885e1e1c055f751a999749d6f057cd55937c /drivers/scsi/NCR5380.h | |
parent | 5386f6734dbc570074a634d56215b2fa168ac034 (diff) | |
download | linux-204714e68015d6946279719fd464ecaf57240f35.tar.xz |
scsi: bfa: Ensure the copied buf is NUL terminated
[ Upstream commit 13d0cecb4626fae67c00c84d3c7851f6b62f7df3 ]
Currently, we allocate a nbytes-sized kernel buffer and copy nbytes from
userspace to that buffer. Later, we use sscanf on this buffer but we don't
ensure that the string is terminated inside the buffer, this can lead to
OOB read when using sscanf. Fix this issue by using memdup_user_nul instead
of memdup_user.
Fixes: 9f30b674759b ("bfa: replace 2 kzalloc/copy_from_user by memdup_user")
Signed-off-by: Bui Quang Minh <minhquangbui99@gmail.com>
Link: https://lore.kernel.org/r/20240424-fix-oob-read-v2-3-f1f1b53a10f4@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/scsi/NCR5380.h')
0 files changed, 0 insertions, 0 deletions