[PATCH 2/3] wininet: Make heap_strndupAtoW stop at the first null

Tim Clem tclem at codeweavers.com
Fri Jul 2 11:47:01 CDT 2021


Hm, I see your point, and the third patch in this set actually fixes the behavior of both
CrackURLA and W, since the first calls the second. But, heap_strndupAtoW is definitely
not doing what it's supposed to do in this case - all other strndups, including
heap_strndupW in the same header, tread the length as a maximum and stop at the first
null. I worry that leaving this as-is is asking for trouble.

July 2, 2021 9:13 AM, "Jacek Caban" <jacek at codeweavers.com> wrote:

> Hi Tim,
> 
> On 7/1/21 7:40 PM, Tim Clem wrote:
> 
>> @@ -152,7 +152,10 @@ static inline WCHAR *heap_strndupAtoW(const char *str, int len_a, DWORD
>> *len_w)
>>> if(str) {
>> size_t len;
>> - if(len_a < 0) len_a = strlen(str);
>> + if(len_a < 0)
>> + len_a = strlen(str);
>> + else if(len_a > 0)
>> + len_a = strnlen(str, len_a);
> 
> The problem seems specific to InternetCrackUrlA, I'm not sure if we should change general helper.
> 
> Thanks,
> 
> Jacek



More information about the wine-devel mailing list