Commit 07daeff8 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

wininet: Always make copies of strings passed to INTERNET_SendCallback.

This ensures that applications that change the strings received in status callbacks don't affect the data needed to successfully connect to the correct server.
parent d72f741a
......@@ -56,21 +56,25 @@ static VOID WINAPI callback(
trace("%04x:Callback %p 0x%lx INTERNET_STATUS_RESOLVING_NAME \"%s\" %d\n",
GetCurrentThreadId(), hInternet, dwContext,
(LPCSTR)lpvStatusInformation,dwStatusInformationLength);
*(LPSTR)lpvStatusInformation = '\0';
break;
case INTERNET_STATUS_NAME_RESOLVED:
trace("%04x:Callback %p 0x%lx INTERNET_STATUS_NAME_RESOLVED \"%s\" %d\n",
GetCurrentThreadId(), hInternet, dwContext,
(LPCSTR)lpvStatusInformation,dwStatusInformationLength);
*(LPSTR)lpvStatusInformation = '\0';
break;
case INTERNET_STATUS_CONNECTING_TO_SERVER:
trace("%04x:Callback %p 0x%lx INTERNET_STATUS_CONNECTING_TO_SERVER \"%s\" %d\n",
GetCurrentThreadId(), hInternet, dwContext,
(LPCSTR)lpvStatusInformation,dwStatusInformationLength);
*(LPSTR)lpvStatusInformation = '\0';
break;
case INTERNET_STATUS_CONNECTED_TO_SERVER:
trace("%04x:Callback %p 0x%lx INTERNET_STATUS_CONNECTED_TO_SERVER \"%s\" %d\n",
GetCurrentThreadId(), hInternet, dwContext,
(LPCSTR)lpvStatusInformation,dwStatusInformationLength);
*(LPSTR)lpvStatusInformation = '\0';
break;
case INTERNET_STATUS_SENDING_REQUEST:
trace("%04x:Callback %p 0x%lx INTERNET_STATUS_SENDING_REQUEST %p %d\n",
......@@ -150,6 +154,7 @@ static VOID WINAPI callback(
trace("%04x:Callback %p 0x%lx INTERNET_STATUS_REDIRECT \"%s\" %d\n",
GetCurrentThreadId(), hInternet, dwContext,
(LPCSTR)lpvStatusInformation, dwStatusInformationLength);
*(LPSTR)lpvStatusInformation = '\0';
break;
case INTERNET_STATUS_INTERMEDIATE_RESPONSE:
trace("%04x:Callback %p 0x%lx INTERNET_STATUS_INTERMEDIATE_RESPONSE %p %d\n",
......
......@@ -231,13 +231,25 @@ VOID INTERNET_SendCallback(LPWININETHANDLEHEADER hdr, DWORD dwContext,
case INTERNET_STATUS_CONNECTING_TO_SERVER:
case INTERNET_STATUS_CONNECTED_TO_SERVER:
lpvNewInfo = WININET_strdup_AtoW(lpvStatusInfo);
break;
case INTERNET_STATUS_RESOLVING_NAME:
case INTERNET_STATUS_REDIRECT:
lpvNewInfo = WININET_strdupW(lpvStatusInfo);
break;
}
}else {
switch(dwInternetStatus)
{
case INTERNET_STATUS_NAME_RESOLVED:
case INTERNET_STATUS_CONNECTING_TO_SERVER:
case INTERNET_STATUS_CONNECTED_TO_SERVER:
lpvNewInfo = HeapAlloc(GetProcessHeap(), 0, strlen(lpvStatusInfo) + 1);
if (lpvNewInfo) strcpy(lpvNewInfo, lpvStatusInfo);
break;
case INTERNET_STATUS_RESOLVING_NAME:
case INTERNET_STATUS_REDIRECT:
lpvNewInfo = WININET_strdup_WtoA(lpvStatusInfo);
break;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment