[PATCH 4/5] wininet: return the required buffer size from InternetGetLastResponseInfo() when it's too small

Jacek Caban jacek at codeweavers.com
Fri Jul 2 10:58:26 CDT 2021


On 6/30/21 8:16 PM, Damjan Jovanovic wrote:
> @@ -1134,8 +1141,14 @@ BOOL WINAPI InternetGetLastResponseInfoW(LPDWORD lpdwError,
>       }
>       if (lpwite)
>       {
> +        if (lpszBuffer == NULL || *lpdwBufferLength < strlen(lpwite->response))
> +        {
> +            *lpdwBufferLength = strlen(lpwite->response);
> +            SetLastError(ERROR_INSUFFICIENT_BUFFER);
> +            return FALSE;
> +        }


Conversion to Unicode may change the length and it looks like we should 
return Unicode length here. You may get the value from 
MultiByteToWideChar, passing NULL output.


Thanks,

Jacek




More information about the wine-devel mailing list