Re: [patch] target: strlen() doesn't count the terminator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2011-07-27 at 14:11 +0300, Dan Carpenter wrote:
> This test is off by one because the NUL terminator isn't taken into
> consideration.
> 
> Signed-off-by: Dan Carpenter <error27@xxxxxxxxx>
> 
> diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
> index 494bfa4..4793875 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);

Committed as e8f4d726c69 into lio-core-2.6.git/master

Thanks!

--nab

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux