fix crash when large buffers are sent through HCTrace (#787)
This commit is contained in:
Родитель
3df5588fc0
Коммит
ffe0ee95aa
|
@ -113,7 +113,7 @@ Result<HC_UNIQUE_PTR<CurlEasyRequest>> CurlEasyRequest::Initialize(HCCallHandle
|
|||
RETURN_IF_FAILED(HCHttpCallRequestGetTimeout(hcCall, &timeoutSeconds));
|
||||
RETURN_IF_FAILED(easyRequest->SetOpt<long>(CURLOPT_TIMEOUT_MS, timeoutSeconds * 1000));
|
||||
|
||||
RETURN_IF_FAILED(easyRequest->SetOpt<long>(CURLOPT_VERBOSE, 1)); // verbose logging (0 off, 1 on)
|
||||
RETURN_IF_FAILED(easyRequest->SetOpt<long>(CURLOPT_VERBOSE, 0)); // verbose logging (0 off, 1 on)
|
||||
RETURN_IF_FAILED(easyRequest->SetOpt<long>(CURLOPT_HEADER, 0)); // do not write headers to the write callback
|
||||
RETURN_IF_FAILED(easyRequest->SetOpt<char*>(CURLOPT_ERRORBUFFER, easyRequest->m_errorBuffer));
|
||||
|
||||
|
@ -354,7 +354,7 @@ int CurlEasyRequest::DebugCallback(CURL* /*curlHandle*/, curl_infotype type, cha
|
|||
size -= 1;
|
||||
}
|
||||
|
||||
HC_TRACE_INFORMATION(HTTPCLIENT, "CURL %10s - %.*s", event, size, data);
|
||||
HC_TRACE_VERBOSE(HTTPCLIENT, "CURL %10s - %.*s", event, size, data);
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
|
|
@ -41,13 +41,25 @@ int sprintf_s(char* buffer, size_t size, _Printf_format_string_ char const* form
|
|||
return result;
|
||||
}
|
||||
|
||||
#if !HC_PLATFORM_IS_PLAYSTATION
|
||||
template<size_t SIZE>
|
||||
int vsprintf_s(char(&buffer)[SIZE], _Printf_format_string_ char const* format, va_list varArgs) noexcept
|
||||
int vstprintf_s(char(&buffer)[SIZE], _Printf_format_string_ char const* format, va_list varArgs) noexcept
|
||||
{
|
||||
return vsnprintf(buffer, SIZE, format, varArgs);
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
template<size_t SIZE>
|
||||
int vstprintf_s(char(&buffer)[SIZE], _Printf_format_string_ char const* format, va_list varArgs) noexcept
|
||||
{
|
||||
_set_errno(0);
|
||||
_vsnprintf_s(buffer, _TRUNCATE, format, varArgs);
|
||||
|
||||
if (errno != 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HC_PLATFORM_IS_MICROSOFT
|
||||
|
@ -280,7 +292,7 @@ STDAPI_(void) HCTraceImplMessage_v(
|
|||
|
||||
char message[4096] = {};
|
||||
|
||||
auto result = vsprintf_s(message, format, varArgs);
|
||||
auto result = vstprintf_s(message, format, varArgs);
|
||||
|
||||
if (result < 0)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче