From 682c3756874cdf9daa2bbc681e31a87e9e84733f Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Mon, 10 Nov 2025 00:32:58 -0500 Subject: [PATCH] fix: correct handling of domain local ID to read directly in little-endian format --- src/OverteClient.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/OverteClient.cpp b/src/OverteClient.cpp index 6964520..15b4a7b 100644 --- a/src/OverteClient.cpp +++ b/src/OverteClient.cpp @@ -944,9 +944,11 @@ void OverteClient::handleDomainListReply(const char* data, size_t len) { std::cout << "[OverteClient] Session UUID: " << sessionUUID << std::endl; - // Read domain local ID (16-bit) + // Read domain local ID (16-bit) - this is in LITTLE-ENDIAN, not big-endian! + // Do NOT use ntohs() - just read directly on x86 if (offset + 2 > len) return; - uint16_t localID = ntohs(*reinterpret_cast(data + offset)); + uint16_t localID; + std::memcpy(&localID, data + offset, sizeof(uint16_t)); // Direct read, little-endian offset += 2; // Store our local ID for use in sourced packets