Browse Source

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: Dan Carpenter <error27@gmail.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Dan Carpenter 14 years ago
parent
commit
8f50c7f5d6
1 changed files with 1 additions and 1 deletions
  1. 1 1
      drivers/target/iscsi/iscsi_target.c

+ 1 - 1
drivers/target/iscsi/iscsi_target.c

@@ -120,7 +120,7 @@ struct iscsi_tiqn *iscsit_add_tiqn(unsigned char *buf)
 	struct iscsi_tiqn *tiqn = NULL;
 	int ret;
 
-	if (strlen(buf) > ISCSI_IQN_LEN) {
+	if (strlen(buf) >= ISCSI_IQN_LEN) {
 		pr_err("Target IQN exceeds %d bytes\n",
 				ISCSI_IQN_LEN);
 		return ERR_PTR(-EINVAL);