Skip to content
Snippets Groups Projects
Commit 5ace1cdb authored by Botnet4U's avatar Botnet4U :speech_balloon:
Browse files

Queued op may not be a request. Dynamic cast to avoid read access violation in LLMessageLog

parent fa3a5851
No related branches found
No related tags found
No related merge requests found
......@@ -27,7 +27,9 @@
#include "_httpoprequest.h"
#include "_httprequestqueue.h"
static boost::circular_buffer<LogPayload> sRingBuffer = boost::circular_buffer<LogPayload>(2048);
namespace {
boost::circular_buffer<LogPayload> sRingBuffer = boost::circular_buffer<LogPayload>(2048);
} // namespace
LLMessageLogEntry::LLMessageLogEntry(LLHost from_host, LLHost to_host, U8* data, size_t data_size)
: mType(TEMPLATE)
......@@ -148,16 +150,18 @@ EHTTPMethod convertEMethodToEHTTPMethod(const LLCore::HttpOpRequest::EMethod e_m
/* static */
void LLMessageLog::log(const LLCore::HttpRequestQueue::opPtr_t& op)
{
if (!haveLogger()) return;
if (!haveLogger()) { return; }
const auto req = std::dynamic_pointer_cast<LLCore::HttpOpRequest>(op);
if (!req) { return; }
auto req = std::static_pointer_cast<LLCore::HttpOpRequest>(op);
U8* data = nullptr;
size_t data_size = 0;
LLCore::BufferArray * body = req->mReqBody;
if (body)
{
data = new U8[body->size()];
size_t len(body->read(0, data, body->size()));
const size_t len(body->read(0, data, body->size()));
data_size = (len > body->size()) ? len : body->size();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment