Skip to content

Commit

Permalink
Stratum: fixed an unaligned memory read
Browse files Browse the repository at this point in the history
  • Loading branch information
SChernykh committed Aug 31, 2024
1 parent ab6b084 commit a003486
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/stratum_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint32_t*>(line_start) == 0x20544547U)) {
if ((c - line_start >= 4) && (read_unaligned(reinterpret_cast<uint32_t*>(line_start)) == 0x20544547U)) {
LOGINFO(5, "client " << log::Gray() << static_cast<const char*>(m_addrString) << log::NoColor() << " sent an HTTP request");
send_http_response();
close();
Expand Down

0 comments on commit a003486

Please sign in to comment.