Browse Source

aprs: Fix out-of-bounds access when parsing BITS telemetry

cppcheck reported a possible out-of-bounds access in the BITS telemetry
message parser. The bounds check was reversed, causing m_message[i] to
be accessed when i was beyond the end of the string.

Correct the condition so missing bit sense values continue to use the
existing default value.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
chirpmodem-v8.0.0
Robin Getz 4 months ago
parent
commit
26c484d668
No known key found for this signature in database
GPG Key ID: 51C7231FFED0E060
  1. 2
      sdrbase/util/aprs.cpp

2
sdrbase/util/aprs.cpp

@ -953,7 +953,7 @@ bool APRSPacket::parseMessage(QString& info, int& idx) @@ -953,7 +953,7 @@ bool APRSPacket::parseMessage(QString& info, int& idx)
int i = 5;
for (int j = 0; j < 8; j++)
{
if (i >= m_message.length())
if (i < m_message.length())
m_telemetryBitSense[j] = m_message[i] == '1';
else
m_telemetryBitSense[j] = true;

Loading…
Cancel
Save