From 45fc9996e2899f9070f82ce6f92e6cae0108ce8b Mon Sep 17 00:00:00 2001 From: Kelsi Date: Thu, 5 Feb 2026 12:50:05 -0800 Subject: [PATCH] Handle variable LOGON_PROOF failure response sizes Some servers send 2 bytes for failure, others send 4. Consume up to 4 if available, otherwise accept the 2-byte minimum. --- src/network/tcp_socket.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/network/tcp_socket.cpp b/src/network/tcp_socket.cpp index a2a373e8..327c83f8 100644 --- a/src/network/tcp_socket.cpp +++ b/src/network/tcp_socket.cpp @@ -225,13 +225,14 @@ size_t TCPSocket::getExpectedPacketSize(uint8_t opcode) { case 0x01: // LOGON_PROOF response // Success: opcode(1) + status(1) + M2(20) + accountFlags(4) + surveyId(4) + loginFlags(2) = 32 - // Failure: opcode(1) + status(1) + padding(2) = 4 + // Failure: varies by server — minimum 2 bytes (opcode + status), some send 4 if (receiveBuffer.size() >= 2) { uint8_t status = receiveBuffer[1]; if (status == 0x00) { - return 32; // Success + return 32; // Success (WotLK 3.3.5a format) } else { - return 4; // Failure + // Consume up to 4 bytes if available, minimum 2 + return (receiveBuffer.size() >= 4) ? 4 : 2; } } return 0; // Need more data