From c220fa2b61607a5b376c32ef223e5df526956989 Mon Sep 17 00:00:00 2001 From: Diman Todorov Date: Sat, 3 Sep 2022 23:33:30 -0700 Subject: [PATCH 1/2] Added missing 0x20 in DCS EncodeDisconnectPacket As is, EncodeDisconnectPacket will fail IsValidDisconnectPacket check. The encoded packet is only has 18 bytes instead of 19 because it's missing a 0x20. --- src/cdcsprotocol.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cdcsprotocol.cpp b/src/cdcsprotocol.cpp index 27a0d79..7007f5e 100644 --- a/src/cdcsprotocol.cpp +++ b/src/cdcsprotocol.cpp @@ -526,6 +526,7 @@ void CDcsProtocol::EncodeDisconnectPacket(CBuffer *Buffer, CClient *Client) Buffer->Set((uint8 *)(const char *)Client->GetCallsign(), CALLSIGN_LEN-1); Buffer->Append((uint8)' '); Buffer->Append((uint8)Client->GetModule()); + Buffer->Append((uint8)' '); Buffer->Append((uint8)0x00); Buffer->Append((uint8 *)(const char *)GetReflectorCallsign(), CALLSIGN_LEN-1); Buffer->Append((uint8)' '); From 48f0d867ad9d12807dc831d3e33856b547200bfc Mon Sep 17 00:00:00 2001 From: Diman Todorov Date: Wed, 21 Sep 2022 23:47:55 -0700 Subject: [PATCH 2/2] Addressed PR comment Removed last byte of disconnect packet to ensure equivalence with ircdbgw. --- src/cdcsprotocol.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/cdcsprotocol.cpp b/src/cdcsprotocol.cpp index 7007f5e..11b8b87 100644 --- a/src/cdcsprotocol.cpp +++ b/src/cdcsprotocol.cpp @@ -530,7 +530,6 @@ void CDcsProtocol::EncodeDisconnectPacket(CBuffer *Buffer, CClient *Client) Buffer->Append((uint8)0x00); Buffer->Append((uint8 *)(const char *)GetReflectorCallsign(), CALLSIGN_LEN-1); Buffer->Append((uint8)' '); - Buffer->Append((uint8)0x00); } void CDcsProtocol::EncodeDvPacket(const CDvHeaderPacket &Header, const CDvFramePacket &DvFrame, uint32 iSeq, CBuffer *Buffer) const