diff --git a/src/fsfw/tmtcpacket/ReadablePacketIF.h b/src/fsfw/tmtcpacket/ReadablePacketIF.h index 01478273..bbffbe10 100644 --- a/src/fsfw/tmtcpacket/ReadablePacketIF.h +++ b/src/fsfw/tmtcpacket/ReadablePacketIF.h @@ -5,6 +5,8 @@ class ReadablePacketIF { public: + virtual ~ReadablePacketIF() = default; + /** * This method returns a raw uint8_t pointer to the readable data */ diff --git a/src/fsfw/tmtcpacket/pus/RawUserDataReaderIF.h b/src/fsfw/tmtcpacket/pus/RawUserDataReaderIF.h index e4e515f8..799b7940 100644 --- a/src/fsfw/tmtcpacket/pus/RawUserDataReaderIF.h +++ b/src/fsfw/tmtcpacket/pus/RawUserDataReaderIF.h @@ -6,8 +6,9 @@ class RawUserDataReaderIF { public: - virtual const uint8_t* getUserData() const = 0; - virtual size_t getUserDataLen() const = 0; + ~RawUserDataReaderIF() = default; + [[nodiscard]] virtual const uint8_t* getUserData() const = 0; + [[nodiscard]] virtual size_t getUserDataLen() const = 0; }; #endif // FSFW_TMTCPACKET_RAWDATAIF_H diff --git a/src/fsfw/tmtcpacket/pus/tc/PusTcReader.cpp b/src/fsfw/tmtcpacket/pus/tc/PusTcReader.cpp index c96bed65..bac6d543 100644 --- a/src/fsfw/tmtcpacket/pus/tc/PusTcReader.cpp +++ b/src/fsfw/tmtcpacket/pus/tc/PusTcReader.cpp @@ -23,7 +23,9 @@ ReturnValue_t PusTcReader::parseData(bool withCrc) { if (result != HasReturnvaluesIF::RETURN_OK) { return result; } - if (spReader.getBufSize() < PusTcIF::MIN_SIZE) { + // We already have access to the space packet fields here, so we can perform a sanity check + // on the length field + if (spReader.getFullPacketLen() < spReader.getBufSize()) { return SerializeIF::STREAM_TOO_SHORT; } diff --git a/src/fsfw/tmtcpacket/pus/tm/PusTmReader.cpp b/src/fsfw/tmtcpacket/pus/tm/PusTmReader.cpp index 024d6ac8..807dd8e0 100644 --- a/src/fsfw/tmtcpacket/pus/tm/PusTmReader.cpp +++ b/src/fsfw/tmtcpacket/pus/tm/PusTmReader.cpp @@ -57,7 +57,7 @@ ReturnValue_t PusTmReader::parseData(bool crcCheck) { if (result != HasReturnvaluesIF::RETURN_OK) { return result; } - if (spReader.getBufSize() < PusTmIF::MIN_SIZE) { + if (spReader.getFullPacketLen() < spReader.getBufSize()) { return SerializeIF::STREAM_TOO_SHORT; }