Re: [RFC V0] Exminating the use of HFSPLUS_ATTR_MAX_STRLEN c.f. non-English attributes

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

 



On Thu, 2014-04-10 at 02:04 +0100, Hin-Tak Leung wrote:

> diff --git a/fs/hfsplus/attributes.c b/fs/hfsplus/attributes.c
> index caf89a7..86422bf 100644
> --- a/fs/hfsplus/attributes.c
> +++ b/fs/hfsplus/attributes.c
> @@ -55,7 +55,7 @@ int hfsplus_attr_build_key(struct super_block *sb, hfsplus_btree_key *key,
>  	key->attr.cnid = cpu_to_be32(cnid);
>  	if (name) {
>  		len = strlen(name);
> -		if (len > HFSPLUS_ATTR_MAX_STRLEN) {
> +		if (len > NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN) {
>  			pr_err("invalid xattr name's length\n");
>  			return -EINVAL;
>  		}
> diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c
> index 3034ce6..04b8f5b 100644
> --- a/fs/hfsplus/xattr.c
> +++ b/fs/hfsplus/xattr.c
> @@ -805,14 +805,14 @@ end_removexattr:
>  static int hfsplus_osx_getxattr(struct dentry *dentry, const char *name,
>  					void *buffer, size_t size, int type)
>  {
> -	char xattr_name[HFSPLUS_ATTR_MAX_STRLEN +
> +	char xattr_name[NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN +
>  				XATTR_MAC_OSX_PREFIX_LEN + 1] = {0};

It needs to use dynamic memory allocation in all cases in this patch. It
is dangerous way to have such buffer on stack. 

Thanks,
Vyacheslav Dubeyko.


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




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux