Skip to content

Commit

Permalink
iscsi-target: strlen() doesn't count the terminator
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Nicholas Bellinger committed Jul 27, 2011
1 parent 4a28a3f commit 8f50c7f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/target/iscsi/iscsi_target.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8f50c7f

Please sign in to comment.