Commit eaf4492c authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

rpcrt4: Dynamically allocate the buffer if the fixed size one isn't large…

rpcrt4: Dynamically allocate the buffer if the fixed size one isn't large enough. Don't return an inappropriate error if we fail to get the status text, it's only used for diagnostics.
parent 98bec05e
......@@ -1597,8 +1597,8 @@ static RPC_STATUS rpcrt4_http_check_response(HINTERNET hor)
DWORD status_code;
DWORD size;
DWORD index;
WCHAR status_text[32];
WCHAR buf[32];
WCHAR *status_text = buf;
TRACE("\n");
index = 0;
......@@ -1609,11 +1609,17 @@ static RPC_STATUS rpcrt4_http_check_response(HINTERNET hor)
if (status_code < 400)
return RPC_S_OK;
index = 0;
size = sizeof(status_text);
size = sizeof(buf);
ret = HttpQueryInfoW(hor, HTTP_QUERY_STATUS_TEXT, status_text, &size, &index);
if (!ret)
return GetLastError();
ERR("server returned: %d %s\n", status_code, debugstr_w(status_text));
if (!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{
status_text = HeapAlloc(GetProcessHeap(), 0, size);
ret = HttpQueryInfoW(hor, HTTP_QUERY_STATUS_TEXT, status_text, &size, &index);
}
ERR("server returned: %d %s\n", status_code, ret ? debugstr_w(status_text) : "<status text unavailable>");
if(status_text != buf) HeapFree(GetProcessHeap(), 0, status_text);
if (status_code == HTTP_STATUS_DENIED)
return ERROR_ACCESS_DENIED;
return RPC_S_SERVER_UNAVAILABLE;
......
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