Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: walter harms <wharms-fPG8STNUNVg@public.gmane.org>
To: Dan Carpenter <error27-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Steve French <sfrench-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>,
	"open list:COMMON INTERNET F..."
	<linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"open list:COMMON INTERNET F..."
	<samba-technical-w/Ol4Ecudpl8XjKLYN78aQ@public.gmane.org>,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [patch] cifs: update limit for snprintf() in cifs_construct_tcon()
Date: Fri, 17 Jun 2011 13:28:25 +0200	[thread overview]
Message-ID: <4DFB3A59.1020805@bfs.de> (raw)
In-Reply-To: <20110617103059.GE2520-z0WHZYlhLlzP0Z7Jsv878P8+0UxHXcjY@public.gmane.org>



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

  parent reply	other threads:[~2011-06-17 11:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-17 10:31 [patch] cifs: update limit for snprintf() in cifs_construct_tcon() Dan Carpenter
     [not found] ` <20110617103059.GE2520-z0WHZYlhLlzP0Z7Jsv878P8+0UxHXcjY@public.gmane.org>
2011-06-17 11:28   ` walter harms [this message]
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       ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DFB3A59.1020805@bfs.de \
    --to=wharms-fpg8stnunvg@public.gmane.org \
    --cc=error27-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=samba-technical-w/Ol4Ecudpl8XjKLYN78aQ@public.gmane.org \
    --cc=sfrench-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox