diff --git a/lib/src/upper/rlc_am.cc b/lib/src/upper/rlc_am.cc index e4a6242fa..26f42af84 100644 --- a/lib/src/upper/rlc_am.cc +++ b/lib/src/upper/rlc_am.cc @@ -587,7 +587,8 @@ int rlc_am::build_segment(uint8_t *payload, uint32_t nof_bytes, rlc_amd_retx_t r rrc->get_rb_name(lcid).c_str(), nof_bytes, head_len); return 0; } - pdu_space = nof_bytes-head_len-2; + + pdu_space = nof_bytes-head_len; if(pdu_space < (retx.so_end-retx.so_start)) retx.so_end = retx.so_start+pdu_space; @@ -603,10 +604,13 @@ int rlc_am::build_segment(uint8_t *payload, uint32_t nof_bytes, rlc_amd_retx_t r if(lower >= retx.so_end) break; + if(pdu_space <= 2) + break; + upper += old_header.li[i]; head_len = rlc_am_packed_length(&new_header); - pdu_space = nof_bytes-head_len-2; + pdu_space = nof_bytes-head_len; if(pdu_space < (retx.so_end-retx.so_start)) retx.so_end = retx.so_start+pdu_space;