add check for invalid nof subheaders in MAC PDU

master
Andre Puschmann 7 years ago
parent c850e2f87a
commit d66a455479

@ -132,7 +132,12 @@ uint8_t* sch_pdu::write_packet(srslte::log *log_h)
log_h->error("init_rem_len=%d\n", init_rem_len); log_h->error("init_rem_len=%d\n", init_rem_len);
return NULL; return NULL;
} }
if (nof_subheaders <= 0) {
log_h->error("Trying to write packet with invalid number of subheaders (nof_subheaders=%d).\n", nof_subheaders);
return NULL;
}
/* If last SDU has zero payload, remove it. FIXME: Why happens this?? */ /* If last SDU has zero payload, remove it. FIXME: Why happens this?? */
if (subheaders[nof_subheaders-1].get_payload_size() == 0) { if (subheaders[nof_subheaders-1].get_payload_size() == 0) {
del_subh(); del_subh();

Loading…
Cancel
Save