提交 fdc84d11 编写于 作者: J Joern Engel 提交者: Nicholas Bellinger

iscsi-target: use strlcpy in iscsit_collect_login_stats

last_intr_fail_name is a fixed-size array and could theoretically
overflow.  In reality intrname->value doesn't seem to depend on
untrusted input or be anywhere near 224 characters, so the overflow is
pretty theoretical.  But strlcpy is cheap enough.

Found by coverity.
Signed-off-by: NJoern Engel <joern@logfs.org>
Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
上级 94e16e9c
...@@ -1479,8 +1479,9 @@ void iscsit_collect_login_stats( ...@@ -1479,8 +1479,9 @@ void iscsit_collect_login_stats(
if (conn->param_list) if (conn->param_list)
intrname = iscsi_find_param_from_key(INITIATORNAME, intrname = iscsi_find_param_from_key(INITIATORNAME,
conn->param_list); conn->param_list);
strcpy(ls->last_intr_fail_name, strlcpy(ls->last_intr_fail_name,
(intrname ? intrname->value : "Unknown")); (intrname ? intrname->value : "Unknown"),
sizeof(ls->last_intr_fail_name));
ls->last_intr_fail_ip_family = conn->login_family; ls->last_intr_fail_ip_family = conn->login_family;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册