[PATCH] pass correct buffersize to LCMapStringW
Dmitry Timoshkov
dmitry at codeweavers.com
Tue Sep 16 05:02:42 CDT 2008
"Rob Shearman" <robertshearman at gmail.com> wrote:
>>>> > - ret = LCMapStringW(LOCALE_USER_DEFAULT, 0, upper_case, 0, buf, sizeof(buf));
>>>> > + ret = LCMapStringW(LOCALE_USER_DEFAULT, 0, upper_case, 0, buf, sizeof(buf)/sizeof(WCHAR));
>>>> > ok(!ret, "LCMapStringW should fail with srclen = 0\n");
>>>> The size of the target buffer doesn't matter at all in this case, since
>>>> the API is supposed to fail due to source length being 0.
>>>
>>> Even if the size doesn't matter, this line should get fixed, as the Wine
>>> tests are a kind of of Win32 API reference by example. IMHO you
>>> shouldn't include such misleading parameters as the size in the wrong
>>> unit into API usage examples.
>>
>> This particular test doesn't depend on the size of the target buffer,
>> be it 0, -1, or whatever.
>
> I don't understand your objection to fixing this. If by chance
> Microsoft happen to change the API to not fail when the source length
> is 0 then this will suddenly become a possible buffer overrun.
If the source length is 0, then there is nothing to write to the destination,
and therefore there shouldn't be a buffer overrun problem.
> Why not
> just pass in a correct length as the destination length or just pass
> in 0?
Because that wouldn't change anything IMO.
--
Dmitry.
More information about the wine-devel
mailing list