From 99964c1054661120e9c40657582c1f99dad18ffe Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Mon, 30 Jul 2018 14:54:49 +0200 Subject: [PATCH] fix RLC AM issue when building segements that require N_li in header --- lib/src/upper/rlc_am.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/src/upper/rlc_am.cc b/lib/src/upper/rlc_am.cc index 71eb6fa34..92c33f652 100644 --- a/lib/src/upper/rlc_am.cc +++ b/lib/src/upper/rlc_am.cc @@ -663,6 +663,11 @@ int rlc_am::build_segment(uint8_t *payload, uint32_t nof_bytes, rlc_amd_retx_t r uint32_t pdu_space = 0; head_len = rlc_am_packed_length(&new_header); + if (old_header.N_li > 0) { + // Make sure we can fit at least one N_li element if old header contained at least one + head_len += 2; + } + if(nof_bytes <= head_len) { log->warning("%s Cannot build a PDU segment - %d bytes available, %d bytes required for header\n",