lkml.org 
[lkml]   [2009]   [Aug]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] fat: Read buffer overflow
Date
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> writes:

> Pekka Enberg <penberg@cs.helsinki.fi> writes:
>
>> Yes, but we pass "ulen" to vfat_is_used_badchars(). The value of
>> "ulen" is a returned in the "longlen" argument of xlate_to_uni() which
>> in turn is calculated as follows for the UTF-8 case:
>>
>> int name_len = strlen(name);
>> *outlen = utf8s_to_utf16s(name, PATH_MAX, (wchar_t *) outname);
>> *outlen -= (name_len - len);
>> *longlen = *outlen;
>>
>> Maybe "*outlen" can never be negative because of some invariants that
>> I don't see but it's so non-obvious to me that I'd like to see the
>> explicit check in vfat_is_used_badchars().
>
> Ah, good point. Sorry, I was looking my tree. I'm going to submit the
> attached patch on next merge window.
>
> Is this enough for it?

BTW, if we want the sanity check of "longlen", I'd like to put it in the
end of xlate_to_uni(), not vfat_is_used_badchars(). Because I think it's
job of xlate_to_uni().

Thanks.
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>


\
 
 \ /
  Last update: 2009-08-08 12:21    [from the cache]
©2003-2011 Jasper Spaans