fix parsing of corrupted MAC PDUs

This commit is contained in:
Andre Puschmann 2019-10-11 16:19:00 +02:00
parent 89889d6df5
commit d8fedf2e19
1 changed files with 10 additions and 1 deletions

View File

@ -136,7 +136,16 @@ public:
ret = subheaders[nof_subheaders].read_subheader(&ptr);
nof_subheaders++;
}
} while (ret && (nof_subheaders + 1) < (int)max_subheaders);
if (ret && (ptr - init_ptr) >= pdu_len) {
// stop processing last subheader indicates another one but all bytes are consume
nof_subheaders = 0;
INFO("Corrupted MAC PDU - all bytes have been consumed (pdu_len=%d)\n", pdu_len);
if (log) {
log->info_hex(init_ptr, pdu_len, "Corrupted MAC PDU - all bytes have been consumed (pdu_len=%d)\n", pdu_len);
}
}
} while (ret && (nof_subheaders + 1) < (int)max_subheaders && pdu_len > (ptr - init_ptr));
for (int i = 0; i < nof_subheaders; i++) {
subheaders[i].read_payload(&ptr);