[linux-cifs-client] try 3: [PATCH] [CIFS] Fixed parsing of mount options when doing DFS submount

Igor Mammedov niallain at gmail.com
Thu Oct 2 13:17:36 GMT 2008


Made computing of node->path_consumed more correct.

Igor Mammedov wrote:
> Steve French wrote:
>> On Wed, Oct 1, 2008 at 6:50 AM, Igor Mammedov <niallain at gmail.com> wrote:
>>> Found a bug in previous patch.
>>> Fixed patch attached
>> At first glance these lines look incorrect:
>>
>> +		if (is_unicode)
>> +			node->path_consumed = node->path_consumed/2;
>>
>> This portion of the path in UTF-8 (or any particular codepage) is not
>> necessarily half as long as the equivalent UCS-16 (Unicode) path in
>> bytes.  In many cases one character in UTF-8 will be one byte, and
>> thus half of the same character represented in UCS-16, but they can be
>> longer.  There are various examples of this in the UCS-16 to UTF-8
>> conversion table that I see at:  http://www.utf8-chartable.de/
> 
> In case of variable character length, a solution could look like:
> 	
> 	char *host_string;
> 	cifs_strncpy_to_host(&host_string, Path_in_UCS, node->path_consumed/2, true, codepage);
> 	node->path_consumed = strlen(host_string);
> 
> Does anybody has a better proposal how to do it?
> 

-- 

Best regards,

-------------------------
Igor Mammedov,
niallain "at" gmail.com




-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fixed-parsing-of-mount-options-when-doing-DFS-submou.patch
Type: text/x-patch
Size: 7829 bytes
Desc: not available
Url : http://lists.samba.org/archive/linux-cifs-client/attachments/20081002/b5afdc9d/0001-Fixed-parsing-of-mount-options-when-doing-DFS-submou.bin


More information about the linux-cifs-client mailing list