From 94da2e8dffaeb8bd049b73ef119447d3b89da93e Mon Sep 17 00:00:00 2001 From: SChernykh <15806605+SChernykh@users.noreply.github.com> Date: Sun, 1 Dec 2024 12:03:44 +0100 Subject: [PATCH] Fixed cppcheck errors --- src/stratum_server.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/stratum_server.cpp b/src/stratum_server.cpp index 151e7c0..db07017 100644 --- a/src/stratum_server.cpp +++ b/src/stratum_server.cpp @@ -1136,6 +1136,7 @@ StratumServer::StratumClient::StratumClient() , m_lastJobTarget(0) , m_score(0) { + m_rawReadBuf[0] = '\0'; m_stratumReadBuf[0] = '\0'; } @@ -1197,7 +1198,8 @@ bool StratumServer::StratumClient::on_read(const char* data, uint32_t size) m_stratumReadBufBytes += size; char* line_start = m_stratumReadBuf; - for (char *e = line_start + m_stratumReadBufBytes, *c = e - size; c < e; ++c) { + const char* e = line_start + m_stratumReadBufBytes; + for (char *c = line_start + m_stratumReadBufBytes - size; c < e; ++c) { if (*c == '\n') { // Check if the line starts with "GET " or "HEAD" (an HTTP request) if (c - line_start >= 4) {