提交 0872774d 编写于 作者: A Alan 提交者: Martin K. Petersen

lpfc: fix missing zero termination in debugfs

If you feed 32 bytes in then the kstrtoull() doesn't receive a terminated
string so will run off the end.
Signed-off-by: NAlan Cox <alan@linux.intel.com>
Reviewed-by: NJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
上级 5b2e0c1b
...@@ -1054,11 +1054,11 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf, ...@@ -1054,11 +1054,11 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf,
{ {
struct dentry *dent = file->f_path.dentry; struct dentry *dent = file->f_path.dentry;
struct lpfc_hba *phba = file->private_data; struct lpfc_hba *phba = file->private_data;
char dstbuf[32]; char dstbuf[33];
uint64_t tmp = 0; uint64_t tmp = 0;
int size; int size;
memset(dstbuf, 0, 32); memset(dstbuf, 0, 33);
size = (nbytes < 32) ? nbytes : 32; size = (nbytes < 32) ? nbytes : 32;
if (copy_from_user(dstbuf, buf, size)) if (copy_from_user(dstbuf, buf, size))
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册