[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201203114040.12656-1-ruc_zhangxiaohui@163.com>
Date: Thu, 3 Dec 2020 19:40:40 +0800
From: Xiaohui Zhang <ruc_zhangxiaohui@....com>
To: martin.petersen@...cle.com, linux-scsi@...r.kernel.org,
target-devel@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Zhang Xiaohui <ruc_zhangxiaohui@....com>
Subject: [PATCH 1/1] target: Make sure no zero value in the buffer
From: Zhang Xiaohui <ruc_zhangxiaohui@....com>
The fix makes sure no zero value in the buffer, by comparing the
strlen() of the original buffer with the size variable.
Signed-off-by: Zhang Xiaohui <ruc_zhangxiaohui@....com>
---
drivers/target/target_core_iblock.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
index f2bd2e207..b23e92449 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -537,6 +537,8 @@ static ssize_t iblock_set_configfs_dev_params(struct se_device *dev,
int ret = 0, token;
unsigned long tmp_readonly;
+ if (strlen(page) < count)
+ return -EOVERFLOW;
opts = kstrdup(page, GFP_KERNEL);
if (!opts)
return -ENOMEM;
--
2.17.1
Powered by blists - more mailing lists