From 647282180bb824b9e0e54f3f68a9a35fbdc06402 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Thu, 23 May 2019 21:59:46 +0200 Subject: [PATCH] nas: fix return value in integrity check --- srsue/src/stack/upper/nas.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/srsue/src/stack/upper/nas.cc b/srsue/src/stack/upper/nas.cc index 01eb4676a..ee1abdfb2 100644 --- a/srsue/src/stack/upper/nas.cc +++ b/srsue/src/stack/upper/nas.cc @@ -523,13 +523,12 @@ bool nas::integrity_check(byte_buffer_t* pdu) { if (!pdu) { nas_log->error("Invalid PDU\n"); - return NULL; + return false; } + if (pdu->N_bytes > 5) { uint8_t exp_mac[4] = {0}; uint8_t *mac = &pdu->msg[1]; - int i; - integrity_generate(&k_nas_int[16], ctxt.rx_count, SECURITY_DIRECTION_DOWNLINK, @@ -538,7 +537,7 @@ bool nas::integrity_check(byte_buffer_t* pdu) &exp_mac[0]); // Check if expected mac equals the sent mac - for(i=0; i<4; i++){ + for (int i = 0; i < 4; i++) { if(exp_mac[i] != mac[i]){ nas_log->warning("Integrity check failure. Local: count=%d, [%02x %02x %02x %02x], " "Received: count=%d, [%02x %02x %02x %02x]\n",