diff --git a/lib/src/upper/rlc.cc b/lib/src/upper/rlc.cc index 807cf46ef..81b25add9 100644 --- a/lib/src/upper/rlc.cc +++ b/lib/src/upper/rlc.cc @@ -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; }