Control added

This commit is contained in:
Bertrand Songis
2019-03-26 14:28:23 +01:00
parent db316af98d
commit 46c883b3b8
2 changed files with 9 additions and 1 deletions
+7 -1
View File
@@ -42,7 +42,13 @@ class ModuleFifo : public Fifo<uint8_t, PXX2_FRAME_MAXLENGTH> {
uint32_t next = nextIndex(ridx);
uint8_t len = fifo[next];
if (unsigned(len + 4 /* 2 bytes header + 2 bytes CRC */) > size()) {
if (len > 40) {
clear();
return false;
}
if (size() < unsigned(len + 4 /* 2 bytes header + 2 bytes CRC */)) {
// frame not fully received
return false;
}