From: Dan Carpenter Date: Wed, 27 Jul 2011 11:11:43 +0000 (+0300) Subject: iscsi-target: strlen() doesn't count the terminator X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=8f50c7f5d63b0e4a29f6f96e8cfaca782e0c458d;p=linux-beck.git 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 Signed-off-by: Nicholas Bellinger --- diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 14c81c4265bd..396c79d8569c 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/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);