[PATCH] pass correct buffersize to LCMapStringW
robertshearman at gmail.com
Tue Sep 16 04:42:36 CDT 2008
2008/9/14 Dmitry Timoshkov <dmitry at codeweavers.com>:
> "Michael Karcher" <wine at mkarcher.dialup.fu-berlin.de> 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. Why not
just pass in a correct length as the destination length or just pass
More information about the wine-devel