[linux-cifs-client] Re: respin of: Fixed parsing of mount options
when doing DFS submount
Igor Mammedov
niallain at gmail.com
Thu Oct 2 09:04:13 GMT 2008
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
More information about the linux-cifs-client
mailing list