From a003486b4ac687c0edbb57dd6c2d9aabfb13137b Mon Sep 17 00:00:00 2001 From: SChernykh <15806605+SChernykh@users.noreply.github.com> Date: Sun, 1 Sep 2024 00:08:45 +0200 Subject: [PATCH] Stratum: fixed an unaligned memory read --- src/stratum_server.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stratum_server.cpp b/src/stratum_server.cpp index 42b1b7f..c82d659 100644 --- a/src/stratum_server.cpp +++ b/src/stratum_server.cpp @@ -1168,7 +1168,7 @@ bool StratumServer::StratumClient::on_read(char* data, uint32_t size) for (char *e = line_start + m_stratumReadBufBytes, *c = e - size; c < e; ++c) { if (*c == '\n') { // Check if the line starts with "GET " (an HTTP request) - if ((c - line_start >= 4) && (*reinterpret_cast(line_start) == 0x20544547U)) { + if ((c - line_start >= 4) && (read_unaligned(reinterpret_cast(line_start)) == 0x20544547U)) { LOGINFO(5, "client " << log::Gray() << static_cast(m_addrString) << log::NoColor() << " sent an HTTP request"); send_http_response(); close();