39 lines
1.1 KiB
Diff
39 lines
1.1 KiB
Diff
From 9d9ca10db994082a58eaf98de3e1e0a4eb7c930c Mon Sep 17 00:00:00 2001
|
|
From: pengyeqing <pengyeqing@huawei.com>
|
|
Date: Sun, 27 Jan 2019 00:01:32 +0800
|
|
Subject: [PATCH] iscsi-initiator-utils: check initiator name out of range
|
|
|
|
reason:check initiator name out of range
|
|
|
|
Conflict: Fix compile warning which cause compile failure
|
|
|
|
Signed-off-by: pengyeqing <pengyeqing@huawei.com>
|
|
---
|
|
usr/mgmt_ipc.c | 9 ++++++++-
|
|
1 file changed, 8 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/usr/mgmt_ipc.c b/usr/mgmt_ipc.c
|
|
index 1ffcda9..ce4defb 100644
|
|
--- a/usr/mgmt_ipc.c
|
|
+++ b/usr/mgmt_ipc.c
|
|
@@ -168,8 +168,15 @@ mgmt_ipc_session_sync(queue_task_t *qtask)
|
|
static int
|
|
mgmt_ipc_cfg_initiatorname(queue_task_t *qtask)
|
|
{
|
|
- if (dconfig->initiator_name)
|
|
+ if (dconfig->initiator_name) {
|
|
+ if (VALUE_MAXLEN <= strlen(dconfig->initiator_name)){
|
|
+ log_error("iscsid: len[%ld] of initiator name out of range, max len %d.", strlen(dconfig->initiator_name), VALUE_MAXLEN-1);
|
|
+ return ISCSI_ERR_INVAL;
|
|
+ }
|
|
+
|
|
strcpy(qtask->rsp.u.config.var, dconfig->initiator_name);
|
|
+ }
|
|
+
|
|
mgmt_ipc_write_rsp(qtask, ISCSI_SUCCESS);
|
|
return ISCSI_SUCCESS;
|
|
}
|
|
--
|
|
1.8.3.1
|
|
|