rlc: add length check for RLC PDU generation

makes sure that RLC doesn't generate a PDU larger than
the provided grant size
This commit is contained in:
Andre Puschmann 2021-04-10 12:38:28 +02:00
parent c1b66e89a5
commit b991b07167
1 changed files with 4 additions and 0 deletions

View File

@ -294,6 +294,8 @@ int rlc::read_pdu(uint32_t lcid, uint8_t* payload, uint32_t nof_bytes)
logger.warning("LCID %d doesn't exist.", lcid);
}
srsran_expect(ret <= nof_bytes, "Created too big RLC PDU (%d > %d)", ret, nof_bytes);
return ret;
}
@ -309,6 +311,8 @@ int rlc::read_pdu_mch(uint32_t lcid, uint8_t* payload, uint32_t nof_bytes)
logger.warning("LCID %d doesn't exist.", lcid);
}
srsran_expect(ret <= nof_bytes, "Created too big RLC PDU for MCH (%d > %d)", ret, nof_bytes);
return ret;
}