mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
scsi: lpfc: Terminate string in lpfc_debugfs_nvmeio_trc_write()
[ Upstream commit9020be114a] The "mybuf" string comes from the user, so we need to ensure that it is NUL terminated. Link: https://lore.kernel.org/r/20211214070527.GA27934@kili Fixes:bd2cdd5e40("scsi: lpfc: NVME Initiator: Add debugfs support") Reviewed-by: James Smart <jsmart2021@gmail.com> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
4833ad4908
commit
fcb32eb3d0
@@ -2956,8 +2956,8 @@ lpfc_debugfs_nvmeio_trc_write(struct file *file, const char __user *buf,
|
|||||||
char mybuf[64];
|
char mybuf[64];
|
||||||
char *pbuf;
|
char *pbuf;
|
||||||
|
|
||||||
if (nbytes > 64)
|
if (nbytes > 63)
|
||||||
nbytes = 64;
|
nbytes = 63;
|
||||||
|
|
||||||
memset(mybuf, 0, sizeof(mybuf));
|
memset(mybuf, 0, sizeof(mybuf));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user