From 1a03839f78b9fffaf038dce3d4b619ea7e053930 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Fri, 16 Oct 2020 14:20:35 +0200 Subject: [PATCH] rlc_am_lte: fix potential bug when setting uint32_t to -1 discovered in Coverity CID 359664 --- lib/src/upper/rlc_am_lte.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/src/upper/rlc_am_lte.cc b/lib/src/upper/rlc_am_lte.cc index 32bbeb64d..1117bd9c8 100644 --- a/lib/src/upper/rlc_am_lte.cc +++ b/lib/src/upper/rlc_am_lte.cc @@ -872,7 +872,9 @@ int rlc_am_lte::rlc_am_lte_tx::build_data_pdu(uint8_t* payload, uint32_t nof_byt } head_len = rlc_am_packed_length(&header); if (head_len >= pdu_space) { - header.N_li--; + if (header.N_li > 0) { + header.N_li--; + } break; } tx_sdu = tx_sdu_queue.read();