Re: [patch] cifs: update limit for snprintf() in cifs_construct_tcon()

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

 




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@xxxxxxxxx>
> ---
> 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@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
--
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