From c840090341fa47f6b748ec41c1c1b7edeac96c6e Mon Sep 17 00:00:00 2001 From: Mathias Weyland Date: Tue, 3 May 2016 23:22:13 +0200 Subject: [PATCH] Swap source and dest call when extracting calls from YSF DCH header (CSD1). According to table 4-2 of the spec, CSD1 starts with the 10 byte destination call and ends with the 10 byte source call. The code had it the other way round. --- YSFPayload.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/YSFPayload.cpp b/YSFPayload.cpp index 156f2cb..959ab28 100644 --- a/YSFPayload.cpp +++ b/YSFPayload.cpp @@ -136,17 +136,17 @@ bool CYSFPayload::processHeaderData(unsigned char* data) for (unsigned int i = 0U; i < 20U; i++) output[i] ^= WHITENING_DATA[i]; - CUtils::dump(1U, "Header, Source", output + 0U, 10U); - CUtils::dump(1U, "Header, Destination", output + 10U, 10U); - - if (m_source == NULL) { - m_source = new unsigned char[10U]; - ::memcpy(m_source, output + 0U, 10U); - } + CUtils::dump(1U, "Header, Destination", output + 0U, 10U); + CUtils::dump(1U, "Header, Source", output + 10U, 10U); if (m_dest == NULL) { m_dest = new unsigned char[10U]; - ::memcpy(m_dest, output + 10U, 10U); + ::memcpy(m_dest, output + 0U, 10U); + } + + if (m_source == NULL) { + m_source = new unsigned char[10U]; + ::memcpy(m_source, output + 10U, 10U); } for (unsigned int i = 0U; i < 20U; i++)