target-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] target: Make sure no zero value in the buffer
@ 2020-12-03 11:40 Xiaohui Zhang
  2020-12-06 18:55 ` Bodo Stroesser
  0 siblings, 1 reply; 2+ messages in thread
From: Xiaohui Zhang @ 2020-12-03 11:40 UTC (permalink / raw)
  To: martin.petersen, linux-scsi, target-devel, linux-kernel; +Cc: Zhang Xiaohui

From: Zhang Xiaohui <ruc_zhangxiaohui@163.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@163.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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-06 18:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-03 11:40 [PATCH 1/1] target: Make sure no zero value in the buffer Xiaohui Zhang
2020-12-06 18:55 ` Bodo Stroesser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).