From 9dbb7acffadea0b1e2636564c3e1675400e37b78 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Tue, 26 Apr 2022 11:36:55 +0100 Subject: [PATCH] lib,rlc_am_nr: ensure early return if there is not enough space for payload plus header --- lib/src/rlc/rlc_am_nr.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/src/rlc/rlc_am_nr.cc b/lib/src/rlc/rlc_am_nr.cc index 9b6607040..9b4ad6baa 100644 --- a/lib/src/rlc/rlc_am_nr.cc +++ b/lib/src/rlc/rlc_am_nr.cc @@ -176,6 +176,10 @@ uint32_t rlc_am_nr_tx::read_pdu(uint8_t* payload, uint32_t nof_bytes) */ uint32_t rlc_am_nr_tx::build_new_pdu(uint8_t* payload, uint32_t nof_bytes) { + if (nof_bytes <= min_hdr_size) { + RlcInfo("Not enough bytes for payload plus header. nof_bytes=%d", nof_bytes); + return 0; + } // Read new SDU from TX queue unique_byte_buffer_t tx_sdu; RlcDebug("Reading from RLC SDU queue. Queue size %d", tx_sdu_queue.size());