From ca15dca23d9806605e0f53d9df9aa9c48f5d64e1 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Tue, 26 Jun 2018 18:28:50 +0100 Subject: [PATCH] Check the size of the getStatus return message. --- Modem.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Modem.cpp b/Modem.cpp index 67449df..2e46210 100644 --- a/Modem.cpp +++ b/Modem.cpp @@ -487,6 +487,11 @@ void CModem::clock(unsigned int ms) // if (m_trace) // CUtils::dump(1U, "GET_STATUS", m_buffer, m_length); + if (m_length < 13U) { + LogError("The length of the getStatus from the modem is too short, maybe the firmware is out of date?"); + break; + } + m_tx = (m_buffer[5U] & 0x01U) == 0x01U; bool adcOverflow = (m_buffer[5U] & 0x02U) == 0x02U;