~aleteoryx/muditaos

e4dc40a7c2dadf51320cc6f0279f163b217806b6 — Bartosz Szostak 3 years ago 4012b97
[MOS-741] Fox crashes during the cellular frame processing

Added an additional condition that checks the size of the hacked frame
to avoid processing an incorrect sized frame.
1 files changed, 11 insertions(+), 2 deletions(-)

M module-cellular/modem/mux/CellularMuxFrame.h
M module-cellular/modem/mux/CellularMuxFrame.h => module-cellular/modem/mux/CellularMuxFrame.h +11 -2
@@ 134,8 134,17 @@ class CellularMuxFrame
            else { // long length
                Length = static_cast<uint16_t>(serData[3] >> 1) + (static_cast<uint16_t>(serData[3]) << 7);
            }
            if (serData[3] == 0xFF) // ugly hack for Quectel misimplementation of the standard
                Length = myLen - 6;
            if (serData[3] == 0xFF) { // ugly hack for Quectel misimplementation of the standard
                if (myLen < 6) {
                    LOG_ERROR("The size of the hacked frame is less than 6 bytes. Dropping...");
                    Address     = 0;
                    Control     = 0;
                    frameStatus = EmptyFrame;
                    return;
                }
                else
                    Length = myLen - 6;
            }

            data.clear();
            data.insert(data.begin(),