diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2022-04-01 16:15:55 +0200 |
---|---|---|
committer | pespin <pespin@sysmocom.de> | 2022-04-05 10:22:14 +0000 |
commit | b8b1c0d626a1035320b17b1f786c4b663b7a61da (patch) | |
tree | 386a633afc9140f0fcab9d6648847f349ca54096 | |
parent | 6e511ce624c5bd1e7a9de295e8d8a0e5f651f388 (diff) |
RLCMAC_EncDec: Fix bug decoding LI[0]=0
Change-Id: I86c1b48c922f50013257c8dce405cbad1d77d868
-rw-r--r-- | library/RLCMAC_EncDec.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/library/RLCMAC_EncDec.cc b/library/RLCMAC_EncDec.cc index 97bd0be9..1b569845 100644 --- a/library/RLCMAC_EncDec.cc +++ b/library/RLCMAC_EncDec.cc @@ -513,8 +513,17 @@ RlcmacDlDataBlock dec__RlcmacDlDataBlock(const OCTETSTRING& stream) if (ret_val.blocks().is_bound()) { for (int i = 0; i < ret_val.blocks().size_of(); i++) { unsigned int length = ret_val.blocks()[i].hdr()().length__ind(); + + /* LI[0]=0 indicates: The current LLC PDU would fit within + current RLC data block but the addition of the length + indicator octet (to indicate the LLC PDU boundary) causes the + LLC PDU to extend into another RLC data block */ + if (i == 0 && length == 0) + length = ttcn_buffer.get_read_len(); + if (length > ttcn_buffer.get_read_len()) length = ttcn_buffer.get_read_len(); + ret_val.blocks()[i].payload() = OCTETSTRING(length, ttcn_buffer.get_read_data()); ttcn_buffer.increase_pos(length); } |