lkml.org 
[lkml]   [2003]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH 2.6.0-test11] VFAT fix for UTF-8 and trailing dots
    From
    Date
    Michal Rokos <m.rokos@sh.cvut.cz> writes:

    > The problem is: even if vfat_striptail_len() counts len of name without
    > trailing dots and sets len to the correct value, utf8_mbstowcs() doesn't
    > care about len and takes whole name.
    > So dirs and files with dots can be created on vfat fs and that will
    > cause some problems as you know :)

    [...]

    > if (utf8) {
    > + int name_len = strlen(name);
    > +
    > *outlen = utf8_mbstowcs((wchar_t *)outname, name, PAGE_SIZE);
    > - if (name[len-1] == '.')
    > - *outlen-=2;
    > +
    > + /*
    > + * We stripped '.'s before and set len appropriately,
    > + * but utf8_mbstowcs doesn't care about len
    > + */
    > + *outlen -= (name_len-len);
    > +
    > op = &outname[*outlen * sizeof(wchar_t)];

    Indeed. However, this looks not right fix. I think utf8_mbstowcs()
    should take the length of both outname and name, so we should fix the
    utf8_mbstowcs().

    For example, utf8_mbstowcs(outbuf, outlen, inbuf, inlen);

    Thanks.
    --
    OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:59    [W:0.022 / U:0.128 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site