From d8c7123a8a6afb3cf2f163a446e0a0c177f9f021 Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 17 Jun 2025 09:32:46 +0200 Subject: [PATCH] preventing segfault in DLInformationTransfer at RRC UE --- openair2/RRC/NR_UE/rrc_UE.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index bb58191e24..ce3082ab95 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -1907,22 +1907,22 @@ static int nr_rrc_ue_decode_dcch(NR_UE_RRC_INST_t *rrc, break; case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer: { - NR_DLInformationTransfer_t *dlInformationTransfer = c1->choice.dlInformationTransfer; + NR_DLInformationTransfer_t *dlInfo = c1->choice.dlInformationTransfer; - if (dlInformationTransfer->criticalExtensions.present - == NR_DLInformationTransfer__criticalExtensions_PR_dlInformationTransfer) { + if (dlInfo->criticalExtensions.present == NR_DLInformationTransfer__criticalExtensions_PR_dlInformationTransfer) { + NR_DLInformationTransfer_IEs_t *dlInfo_IE = dlInfo->criticalExtensions.choice.dlInformationTransfer; /* This message hold a dedicated info NAS payload, forward it to NAS */ - NR_DedicatedNAS_Message_t *dedicatedNAS_Message = - dlInformationTransfer->criticalExtensions.choice.dlInformationTransfer->dedicatedNAS_Message; - - MessageDef *ittiMsg = itti_alloc_new_message(TASK_RRC_NRUE, rrc->ue_id, NAS_DOWNLINK_DATA_IND); - dl_info_transfer_ind_t *msg = &NAS_DOWNLINK_DATA_IND(ittiMsg); - msg->UEid = rrc->ue_id; - msg->nasMsg.length = dedicatedNAS_Message->size; - msg->nasMsg.nas_data = malloc(msg->nasMsg.length); - memcpy(msg->nasMsg.nas_data, dedicatedNAS_Message->buf, msg->nasMsg.length); - itti_send_msg_to_task(TASK_NAS_NRUE, rrc->ue_id, ittiMsg); - dedicatedNAS_Message->buf = NULL; // to keep the buffer, up to NAS to free it + NR_DedicatedNAS_Message_t *dedicatedNAS_Message = dlInfo_IE->dedicatedNAS_Message; + if (dedicatedNAS_Message) { + MessageDef *ittiMsg = itti_alloc_new_message(TASK_RRC_NRUE, rrc->ue_id, NAS_DOWNLINK_DATA_IND); + dl_info_transfer_ind_t *msg = &NAS_DOWNLINK_DATA_IND(ittiMsg); + msg->UEid = rrc->ue_id; + msg->nasMsg.length = dedicatedNAS_Message->size; + msg->nasMsg.nas_data = malloc(msg->nasMsg.length); + memcpy(msg->nasMsg.nas_data, dedicatedNAS_Message->buf, msg->nasMsg.length); + itti_send_msg_to_task(TASK_NAS_NRUE, rrc->ue_id, ittiMsg); + dedicatedNAS_Message->buf = NULL; // to keep the buffer, up to NAS to free it + } } } break; case NR_DL_DCCH_MessageType__c1_PR_mobilityFromNRCommand: