Re: [PATCH 1/3] hfsplus: fixes worst-case unicode to char conversion of file names and attributes

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

 



On Thu, 17 Apr 2014 20:30:20 +0100 Hin-Tak Leung <hintak.leung@xxxxxxxxx> wrote:

> From: Hin-Tak Leung <htl10@xxxxxxxxxxxxxxxxxxxxx>
> 
> The HFS Plus Volume Format specification (TN1150) states that
> file names are stored internally as a maximum of 255 unicode
> characters, as defined by The Unicode Standard, Version 2.0
> [Unicode, Inc. ISBN 0-201-48345-9]. File names are converted by
> the NLS system on Linux before presented to the user.
> 
> 255 CJK characters converts to UTF-8 with 1 unicode character
> to up to 3 bytes, and to GB18030 with 1 unicode character to
> up to 4 bytes. Thus, trying in a UTF-8 locale to list files
> with names of more than 85 CJK characters results in:
> 
>     $ ls /mnt
>     ls: reading directory /mnt: File name too long
> 
> The receiving buffer to hfsplus_uni2asc() needs to be 255 x
> NLS_MAX_CHARSET_SIZE bytes, not 255 bytes as the code has always been.
> 
> Similar consideration applies to attributes, which are stored
> internally as a maximum of 127 UTF-16BE units. See XNU source for
> an up-to-date reference on attributes.
> 
> Strictly speaking, the maximum value of NLS_MAX_CHARSET_SIZE = 6
> is not attainable in the case of conversion to UTF-8, as going
> beyond 3 bytes requires the use of surrogate pairs, i.e. consuming
> two input units.
> 
> Thanks Anton Altaparmakov for reviewing an earlier version of this
> change.
> 
> This patch fixes all callers of hfsplus_uni2asc(), and also enables
> the use of long non-English file names in HFS+. The getting and
> setting, and general usage of long non-English attributes
> requires further forthcoming work, in the following patches of this
> series.
> 

fs/hfsplus/xattr.c: In function 'hfsplus_listxattr':
fs/hfsplus/xattr.c:673: error: label 'out' used but not defined

--- a/fs/hfsplus/xattr.c~hfsplus-fixes-worst-case-unicode-to-char-conversion-of-file-names-and-attributes-fix
+++ a/fs/hfsplus/xattr.c
@@ -726,6 +726,7 @@ ssize_t hfsplus_listxattr(struct dentry
 
 end_listxattr:
 	kfree(strbuf);
+out:
 	hfs_find_exit(&fd);
 	return res;
 }

But obviously the patches you sent were not the patches you tested. 
What happened here?

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