All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] cifs: update limit for snprintf() in cifs_construct_tcon()
@ 2011-06-17 10:31 ` Dan Carpenter
  0 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2011-06-17 10:31 UTC (permalink / raw)
  To: Steve French
  Cc: open list:COMMON INTERNET F..., open list:COMMON INTERNET F...,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

In 34c87901e113 "Shrink stack space usage in cifs_construct_tcon" we
change the size of the username name buffer from MAX_USERNAME_SIZE
(256) to 28.  This call to snprintf() needs to be updated as well.

Signed-off-by: Dan Carpenter <error27@gmail.com>
---
I know that everyone is going to complain about using a literal but
it's local to this function and it's commented in the lines above.
I'm not opposed to using a define, I suppose, if you give me a good
one, but really I'd just as soon leave it as is.  *eye roll in
advance*.

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 12cf72d..efd1c7a 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -3451,7 +3451,7 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, uid_t fsuid)
 		goto out;
 	}
 
-	snprintf(username, MAX_USERNAME_SIZE, "krb50x%x", fsuid);
+	snprintf(username, 28, "krb50x%x", fsuid);
 	vol_info->username = username;
 	vol_info->local_nls = cifs_sb->local_nls;
 	vol_info->linux_uid = fsuid;

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

* [patch] cifs: update limit for snprintf() in cifs_construct_tcon()
@ 2011-06-17 10:31 ` Dan Carpenter
  0 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2011-06-17 10:31 UTC (permalink / raw)
  To: Steve French
  Cc: open list:COMMON INTERNET F..., open list:COMMON INTERNET F...,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

In 34c87901e113 "Shrink stack space usage in cifs_construct_tcon" we
change the size of the username name buffer from MAX_USERNAME_SIZE
(256) to 28.  This call to snprintf() needs to be updated as well.

Signed-off-by: Dan Carpenter <error27-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
I know that everyone is going to complain about using a literal but
it's local to this function and it's commented in the lines above.
I'm not opposed to using a define, I suppose, if you give me a good
one, but really I'd just as soon leave it as is.  *eye roll in
advance*.

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 12cf72d..efd1c7a 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -3451,7 +3451,7 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, uid_t fsuid)
 		goto out;
 	}
 
-	snprintf(username, MAX_USERNAME_SIZE, "krb50x%x", fsuid);
+	snprintf(username, 28, "krb50x%x", fsuid);
 	vol_info->username = username;
 	vol_info->local_nls = cifs_sb->local_nls;
 	vol_info->linux_uid = fsuid;

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

* Re: [patch] cifs: update limit for snprintf() in cifs_construct_tcon()
       [not found] ` <20110617103059.GE2520-z0WHZYlhLlzP0Z7Jsv878P8+0UxHXcjY@public.gmane.org>
@ 2011-06-17 11:28     ` walter harms
  2011-07-12 18:14     ` Steve French
  1 sibling, 0 replies; 9+ messages in thread
From: walter harms @ 2011-06-17 11:28 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Steve French, open list:COMMON INTERNET F...,
	open list:COMMON INTERNET F...,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA



Am 17.06.2011 12:31, schrieb Dan Carpenter:
> In 34c87901e113 "Shrink stack space usage in cifs_construct_tcon" we
> change the size of the username name buffer from MAX_USERNAME_SIZE
> (256) to 28.  This call to snprintf() needs to be updated as well.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
> I know that everyone is going to complain about using a literal but
> it's local to this function and it's commented in the lines above.
> I'm not opposed to using a define, I suppose, if you give me a good
> one, but really I'd just as soon leave it as is.  *eye roll in
> advance*.
> 
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 12cf72d..efd1c7a 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -3451,7 +3451,7 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, uid_t fsuid)
>  		goto out;
>  	}
>  
> -	snprintf(username, MAX_USERNAME_SIZE, "krb50x%x", fsuid);
> +	snprintf(username, 28, "krb50x%x", fsuid);
>  	vol_info->username = username;
>  	vol_info->local_nls = cifs_sb->local_nls;
>  	vol_info->linux_uid = fsuid;

perhaps we should restrict it in the format also:
  "krb50x%22x"
that would leave the opportunity to have a sane limit,
instead of just cutting.

just my 2 cents,
re,
 wh

just my 2 cents,
re,
 wh



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

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

* Re: [patch] cifs: update limit for snprintf() in cifs_construct_tcon()
@ 2011-06-17 11:28     ` walter harms
  0 siblings, 0 replies; 9+ messages in thread
From: walter harms @ 2011-06-17 11:28 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Steve French, open list:COMMON INTERNET F...,
	open list:COMMON INTERNET F...,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA



Am 17.06.2011 12:31, schrieb Dan Carpenter:
> In 34c87901e113 "Shrink stack space usage in cifs_construct_tcon" we
> change the size of the username name buffer from MAX_USERNAME_SIZE
> (256) to 28.  This call to snprintf() needs to be updated as well.
> 
> Signed-off-by: Dan Carpenter <error27-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
> I know that everyone is going to complain about using a literal but
> it's local to this function and it's commented in the lines above.
> I'm not opposed to using a define, I suppose, if you give me a good
> one, but really I'd just as soon leave it as is.  *eye roll in
> advance*.
> 
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 12cf72d..efd1c7a 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -3451,7 +3451,7 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, uid_t fsuid)
>  		goto out;
>  	}
>  
> -	snprintf(username, MAX_USERNAME_SIZE, "krb50x%x", fsuid);
> +	snprintf(username, 28, "krb50x%x", fsuid);
>  	vol_info->username = username;
>  	vol_info->local_nls = cifs_sb->local_nls;
>  	vol_info->linux_uid = fsuid;

perhaps we should restrict it in the format also:
  "krb50x%22x"
that would leave the opportunity to have a sane limit,
instead of just cutting.

just my 2 cents,
re,
 wh

just my 2 cents,
re,
 wh



> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

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

* Re: [patch] cifs: update limit for snprintf() in cifs_construct_tcon()
       [not found] ` <20110617103059.GE2520-z0WHZYlhLlzP0Z7Jsv878P8+0UxHXcjY@public.gmane.org>
@ 2011-07-12 18:14     ` Steve French
  2011-07-12 18:14     ` Steve French
  1 sibling, 0 replies; 9+ messages in thread
From: Steve French @ 2011-07-12 18:14 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Steve French, open list:COMMON INTERNET F...,
	open list:COMMON INTERNET F...,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

What about the following alternative, so we dont rely on the magic
number as much.

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index dbd669c..ccc1afa 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -3485,7 +3485,7 @@ cifs_construct_tcon(struct cifs_sb_info
*cifs_sb, uid_t fsuid)
 		goto out;
 	}

-	snprintf(username, MAX_USERNAME_SIZE, "krb50x%x", fsuid);
+	snprintf(username, sizeof(username), "krb50x%x", fsuid);
 	vol_info->username = username;
 	vol_info->local_nls = cifs_sb->local_nls;
 	vol_info->linux_uid = fsuid;

On Fri, Jun 17, 2011 at 5:31 AM, Dan Carpenter <error27@gmail.com> wrote:
> In 34c87901e113 "Shrink stack space usage in cifs_construct_tcon" we
> change the size of the username name buffer from MAX_USERNAME_SIZE
> (256) to 28.  This call to snprintf() needs to be updated as well.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
> I know that everyone is going to complain about using a literal but
> it's local to this function and it's commented in the lines above.
> I'm not opposed to using a define, I suppose, if you give me a good
> one, but really I'd just as soon leave it as is.  *eye roll in
> advance*.
>
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 12cf72d..efd1c7a 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -3451,7 +3451,7 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, uid_t fsuid)
>                goto out;
>        }
>
> -       snprintf(username, MAX_USERNAME_SIZE, "krb50x%x", fsuid);
> +       snprintf(username, 28, "krb50x%x", fsuid);
>        vol_info->username = username;
>        vol_info->local_nls = cifs_sb->local_nls;
>        vol_info->linux_uid = fsuid;
>



-- 
Thanks,

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

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

* Re: [patch] cifs: update limit for snprintf() in cifs_construct_tcon()
@ 2011-07-12 18:14     ` Steve French
  0 siblings, 0 replies; 9+ messages in thread
From: Steve French @ 2011-07-12 18:14 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Steve French, open list:COMMON INTERNET F...,
	open list:COMMON INTERNET F...,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

What about the following alternative, so we dont rely on the magic
number as much.

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index dbd669c..ccc1afa 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -3485,7 +3485,7 @@ cifs_construct_tcon(struct cifs_sb_info
*cifs_sb, uid_t fsuid)
 		goto out;
 	}

-	snprintf(username, MAX_USERNAME_SIZE, "krb50x%x", fsuid);
+	snprintf(username, sizeof(username), "krb50x%x", fsuid);
 	vol_info->username = username;
 	vol_info->local_nls = cifs_sb->local_nls;
 	vol_info->linux_uid = fsuid;

On Fri, Jun 17, 2011 at 5:31 AM, Dan Carpenter <error27-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> In 34c87901e113 "Shrink stack space usage in cifs_construct_tcon" we
> change the size of the username name buffer from MAX_USERNAME_SIZE
> (256) to 28.  This call to snprintf() needs to be updated as well.
>
> Signed-off-by: Dan Carpenter <error27-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
> I know that everyone is going to complain about using a literal but
> it's local to this function and it's commented in the lines above.
> I'm not opposed to using a define, I suppose, if you give me a good
> one, but really I'd just as soon leave it as is.  *eye roll in
> advance*.
>
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 12cf72d..efd1c7a 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -3451,7 +3451,7 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, uid_t fsuid)
>                goto out;
>        }
>
> -       snprintf(username, MAX_USERNAME_SIZE, "krb50x%x", fsuid);
> +       snprintf(username, 28, "krb50x%x", fsuid);
>        vol_info->username = username;
>        vol_info->local_nls = cifs_sb->local_nls;
>        vol_info->linux_uid = fsuid;
>



-- 
Thanks,

Steve

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

* Re: [patch] cifs: update limit for snprintf() in cifs_construct_tcon()
  2011-07-12 18:14     ` Steve French
  (?)
@ 2011-07-12 18:16     ` Jeremy Allison
  -1 siblings, 0 replies; 9+ messages in thread
From: Jeremy Allison @ 2011-07-12 18:16 UTC (permalink / raw)
  To: Steve French; +Cc: linux-cifs, samba-technical

On Tue, Jul 12, 2011 at 01:14:00PM -0500, Steve French wrote:
> What about the following alternative, so we dont rely on the magic
> number as much.

Steve,

	Where is my transport level encryption ?

This is your weekly ping from me on this :-).

Just so you don't forget.. :-).

Jeremy.

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

* Re: [patch] cifs: update limit for snprintf() in
       [not found]     ` <CAH2r5mu6TuWs6P8ZeR1=KCv8BLSu0_Z8b2uoVUqXhw55=39CWg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2011-07-12 18:20         ` Dan Carpenter
  0 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2011-07-12 18:20 UTC (permalink / raw)
  To: Steve French
  Cc: Steve French, open list:COMMON INTERNET F...,
	open list:COMMON INTERNET F...,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

On Tue, Jul 12, 2011 at 01:14:00PM -0500, Steve French wrote:
> What about the following alternative, so we dont rely on the magic
> number as much.
> 

Yeah.  That's better.  Want me to do anything or will you just give
me the reported-by?

regards,
dan carpenter


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

* Re: [patch] cifs: update limit for snprintf() in cifs_construct_tcon()
@ 2011-07-12 18:20         ` Dan Carpenter
  0 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2011-07-12 18:20 UTC (permalink / raw)
  To: Steve French
  Cc: Steve French, open list:COMMON INTERNET F...,
	open list:COMMON INTERNET F...,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

On Tue, Jul 12, 2011 at 01:14:00PM -0500, Steve French wrote:
> What about the following alternative, so we dont rely on the magic
> number as much.
> 

Yeah.  That's better.  Want me to do anything or will you just give
me the reported-by?

regards,
dan carpenter

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

end of thread, other threads:[~2011-07-12 18:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-17 10:31 [patch] cifs: update limit for snprintf() in cifs_construct_tcon() Dan Carpenter
2011-06-17 10:31 ` Dan Carpenter
     [not found] ` <20110617103059.GE2520-z0WHZYlhLlzP0Z7Jsv878P8+0UxHXcjY@public.gmane.org>
2011-06-17 11:28   ` walter harms
2011-06-17 11:28     ` walter harms
2011-07-12 18:14   ` Steve French
2011-07-12 18:14     ` Steve French
2011-07-12 18:16     ` Jeremy Allison
     [not found]     ` <CAH2r5mu6TuWs6P8ZeR1=KCv8BLSu0_Z8b2uoVUqXhw55=39CWg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-07-12 18:20       ` [patch] cifs: update limit for snprintf() in Dan Carpenter
2011-07-12 18:20         ` [patch] cifs: update limit for snprintf() in cifs_construct_tcon() Dan Carpenter

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.