All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] target: strlen() doesn't count the terminator
@ 2011-07-27 11:11 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2011-07-27 11:11 UTC (permalink / raw)
  To: Nicholas A. Bellinger
  Cc: Andy Grover, Roland Dreier, Christoph Hellwig,
	open list:TARGET SUBSYSTEM, kernel-janitors

This test is off by one because the NUL terminator isn't taken into
consideration.

Signed-off-by: Dan Carpenter <error27@gmail.com>

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);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [patch] target: strlen() doesn't count the terminator
@ 2011-07-27 11:11 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2011-07-27 11:11 UTC (permalink / raw)
  To: Nicholas A. Bellinger
  Cc: Andy Grover, Roland Dreier, Christoph Hellwig,
	open list:TARGET SUBSYSTEM, kernel-janitors

This test is off by one because the NUL terminator isn't taken into
consideration.

Signed-off-by: Dan Carpenter <error27@gmail.com>

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);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [patch] target: strlen() doesn't count the terminator
  2011-07-27 11:11 ` Dan Carpenter
@ 2011-07-27 19:36   ` Nicholas A. Bellinger
  -1 siblings, 0 replies; 4+ messages in thread
From: Nicholas A. Bellinger @ 2011-07-27 19:36 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Andy Grover, Roland Dreier, Christoph Hellwig,
	open list:TARGET SUBSYSTEM, kernel-janitors, target-devel

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@gmail.com>
> 
> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] target: strlen() doesn't count the terminator
@ 2011-07-27 19:36   ` Nicholas A. Bellinger
  0 siblings, 0 replies; 4+ messages in thread
From: Nicholas A. Bellinger @ 2011-07-27 19:36 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Andy Grover, Roland Dreier, Christoph Hellwig,
	open list:TARGET SUBSYSTEM, kernel-janitors, target-devel

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@gmail.com>
> 
> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-07-27 19:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-27 11:11 [patch] target: strlen() doesn't count the terminator Dan Carpenter
2011-07-27 11:11 ` Dan Carpenter
2011-07-27 19:36 ` Nicholas A. Bellinger
2011-07-27 19:36   ` Nicholas A. Bellinger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.