提交 8f50c7f5 编写于 作者: D Dan Carpenter 提交者: Nicholas Bellinger

iscsi-target: strlen() doesn't count the terminator

This patch fixes an off by one check in iscsit_add_tiqn() because the
NULL terminator isn't taken into consideration.
Signed-off-by: NDan Carpenter <error27@gmail.com>
Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
上级 4a28a3fa
...@@ -120,7 +120,7 @@ struct iscsi_tiqn *iscsit_add_tiqn(unsigned char *buf) ...@@ -120,7 +120,7 @@ struct iscsi_tiqn *iscsit_add_tiqn(unsigned char *buf)
struct iscsi_tiqn *tiqn = NULL; struct iscsi_tiqn *tiqn = NULL;
int ret; int ret;
if (strlen(buf) > ISCSI_IQN_LEN) { if (strlen(buf) >= ISCSI_IQN_LEN) {
pr_err("Target IQN exceeds %d bytes\n", pr_err("Target IQN exceeds %d bytes\n",
ISCSI_IQN_LEN); ISCSI_IQN_LEN);
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册