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 10 Apr 2014, at 08:34, Vyacheslav Dubeyko <slava@xxxxxxxxxxx> wrote:
> 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. 

Did you even _read_ the patch description?

<quote>
They also all need to switch to dynamic allocation (not done here yet, just for simplicity ATM)
</quote>

So your comment is superfluous...

Best regards,

	Anton
-- 
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge
J.J. Thomson Avenue, Cambridge, CB3 0RB, UK

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