diff --git a/src/bridge/HostBridge.NXDN.cpp b/src/bridge/HostBridge.NXDN.cpp index f18f10ec..9a2f2b43 100644 --- a/src/bridge/HostBridge.NXDN.cpp +++ b/src/bridge/HostBridge.NXDN.cpp @@ -107,7 +107,7 @@ void HostBridge::processNXDNNetwork(uint8_t* buffer, uint32_t length) facch.getData(lcBuffer); lc::RTCH lc; - lc.decode(lcBuffer, NXDN_FACCH1_FEC_LENGTH_BITS); + lc.decode(lcBuffer, NXDN_FACCH1_LENGTH_BITS); if (lc.getMessageType() == MessageType::RTCH_VCALL) { m_rxNXDNLC = lc; diff --git a/src/common/nxdn/lc/RTCH.cpp b/src/common/nxdn/lc/RTCH.cpp index e1d74807..69a88288 100644 --- a/src/common/nxdn/lc/RTCH.cpp +++ b/src/common/nxdn/lc/RTCH.cpp @@ -107,6 +107,12 @@ void RTCH::decode(const uint8_t* data, uint32_t length, uint32_t offset) { assert(data != nullptr); + if (length > NXDN_RTCH_LC_LENGTH_BITS) { + LogError(LOG_NXDN, "RTCH::decode(), invalid LC length, len = %u, maximum = %u", + length, NXDN_RTCH_LC_LENGTH_BITS); + return; + } + uint8_t rtch[NXDN_RTCH_LC_LENGTH_BYTES]; ::memset(rtch, 0x00U, NXDN_RTCH_LC_LENGTH_BYTES); diff --git a/src/fne/network/callhandler/TagNXDNData.cpp b/src/fne/network/callhandler/TagNXDNData.cpp index 83bd9a7f..09dfa956 100644 --- a/src/fne/network/callhandler/TagNXDNData.cpp +++ b/src/fne/network/callhandler/TagNXDNData.cpp @@ -148,7 +148,7 @@ bool TagNXDNData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerI uint8_t buffer[10U]; facch.getData(buffer); - lc.decode(buffer, NXDN_FACCH1_FEC_LENGTH_BITS); + lc.decode(buffer, NXDN_FACCH1_LENGTH_BITS); } } else { channel::FACCH1 facch; @@ -173,7 +173,7 @@ bool TagNXDNData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerI uint8_t buffer[10U]; facch.getData(buffer); - lc.decode(buffer, NXDN_FACCH1_FEC_LENGTH_BITS); + lc.decode(buffer, NXDN_FACCH1_LENGTH_BITS); } } } diff --git a/src/host/nxdn/packet/Voice.cpp b/src/host/nxdn/packet/Voice.cpp index a34867ed..9762a458 100644 --- a/src/host/nxdn/packet/Voice.cpp +++ b/src/host/nxdn/packet/Voice.cpp @@ -321,7 +321,7 @@ bool Voice::process(FuncChannelType::E fct, ChOption::E option, uint8_t* data, u facch.getData(buffer); lc::RTCH lc; - lc.decode(buffer, NXDN_FACCH1_FEC_LENGTH_BITS); + lc.decode(buffer, NXDN_FACCH1_LENGTH_BITS); hasInfo = lc.getMessageType() == MessageType::RTCH_VCALL; if (!hasInfo) @@ -668,7 +668,7 @@ bool Voice::processNetwork(FuncChannelType::E fct, ChOption::E option, lc::RTCH& facch.getData(buffer); lc::RTCH lc; - lc.decode(buffer, NXDN_FACCH1_FEC_LENGTH_BITS); + lc.decode(buffer, NXDN_FACCH1_LENGTH_BITS); uint16_t dstId = lc.getDstId(); uint16_t srcId = lc.getSrcId(); bool group = lc.getGroup(); @@ -854,7 +854,7 @@ bool Voice::processNetwork(FuncChannelType::E fct, ChOption::E option, lc::RTCH& facch.getData(buffer); lc::RTCH lc; - lc.decode(buffer, NXDN_FACCH1_FEC_LENGTH_BITS); + lc.decode(buffer, NXDN_FACCH1_LENGTH_BITS); hasInfo = lc.getMessageType() == MessageType::RTCH_VCALL; if (!hasInfo)