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 kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux