[PATCH 4/5] wininet: return the required buffer size from InternetGetLastResponseInfo() when it's too small
Signed-off-by: Damjan Jovanovic <damjan.jov(a)gmail.com> --- dlls/wininet/internet.c | 17 +++++++++++++++-- dlls/wininet/tests/ftp.c | 28 +++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 3 deletions(-)
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
participants (2)
-
Damjan Jovanovic -
Jacek Caban