From 5def5fd73606199ed939e30550143e64e5c7795d Mon Sep 17 00:00:00 2001 From: Paul Sutton Date: Mon, 16 Apr 2018 20:46:04 +0100 Subject: [PATCH] Adding check for invalid PDCP rx PDUs --- lib/src/upper/pdcp_entity.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/src/upper/pdcp_entity.cc b/lib/src/upper/pdcp_entity.cc index c7970ddd6..d8bb0556f 100644 --- a/lib/src/upper/pdcp_entity.cc +++ b/lib/src/upper/pdcp_entity.cc @@ -168,6 +168,12 @@ void pdcp_entity::write_pdu(byte_buffer_t *pdu) log->info_hex(pdu->msg, pdu->N_bytes, "RX %s PDU, do_integrity = %s, do_encryption = %s", rrc->get_rb_name(lcid).c_str(), (do_integrity) ? "true" : "false", (do_encryption) ? "true" : "false"); + // Sanity check + if(pdu->N_bytes <= sn_len_bytes) { + pool->deallocate(pdu); + return; + } + // Handle DRB messages if (cfg.is_data) { uint32_t sn;