iscsi-target: strlen() doesn't count the terminator
authorDan Carpenter <error27@gmail.com>
Wed, 27 Jul 2011 11:11:43 +0000 (14:11 +0300)
committerNicholas Bellinger <nab@linux-iscsi.org>
Wed, 27 Jul 2011 20:28:16 +0000 (20:28 +0000)
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>
drivers/target/iscsi/iscsi_target.c

index 14c81c4265bd912dd4c4113c819d2db39aa58894..396c79d8569c747f65d3e9c71e970e8988d77d97 100644 (file)
@@ -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);