From 4427dbe682ac5737258cf37262623fc265c6a8a3 Mon Sep 17 00:00:00 2001
From: Lionel Gauthier <lionel.gauthier@eurecom.fr>
Date: Thu, 30 Apr 2015 09:23:44 +0000
Subject: [PATCH] Sebastian Held patches15/0021-array-out-of-bounds.patch

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7323 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
 openair2/LAYER2/MAC/defs.h          | 2 +-
 openair2/LAYER2/MAC/ue_procedures.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h
index da402cd9e3a..a8b49b1e0c9 100644
--- a/openair2/LAYER2/MAC/defs.h
+++ b/openair2/LAYER2/MAC/defs.h
@@ -917,7 +917,7 @@ typedef struct {
   /// power backoff due to power management (as allowed by P-MPRc) for this cell
   uint8_t power_backoff_db[NUMBER_OF_eNB_MAX];
   /// MBSFN_Subframe Configuration
-  struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8];
+  struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8]; // FIXME replace 8 by MAX_MBSFN_AREA?
   /// number of subframe allocation pattern available for MBSFN sync area
   uint8_t num_sf_allocation_pattern;
 #ifdef Rel10
diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c
index c753dfd6659..7e09874dc60 100644
--- a/openair2/LAYER2/MAC/ue_procedures.c
+++ b/openair2/LAYER2/MAC/ue_procedures.c
@@ -628,14 +628,14 @@ void ue_send_mch_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP, uint
 int8_t ue_get_mbsfn_sf_alloction (module_id_t module_idP, uint8_t mbsfn_sync_area, unsigned char eNB_index)
 {
   // currently there is one-to-one mapping between sf allocation pattern and sync area
-  if (mbsfn_sync_area > MAX_MBSFN_AREA) {
-    LOG_W(MAC,"[UE %d] MBSFN synchronization area %d out of range for eNB %d\n ", module_idP, mbsfn_sync_area, eNB_index);
+  if (mbsfn_sync_area >= MAX_MBSFN_AREA) {
+    LOG_W( MAC, "[UE %"PRIu8"] MBSFN synchronization area %"PRIu8" out of range for eNB %"PRIu8"\n", module_idP, mbsfn_sync_area, eNB_index );
     return -1;
   } else if (UE_mac_inst[module_idP].mbsfn_SubframeConfig[mbsfn_sync_area] != NULL) {
     return mbsfn_sync_area;
   }
   else {
-    LOG_W(MAC,"[UE %d] MBSFN Subframe Config pattern %d not found \n ", module_idP, mbsfn_sync_area);
+    LOG_W( MAC, "[UE %"PRIu8"] MBSFN Subframe Config pattern %"PRIu8" not found \n", module_idP, mbsfn_sync_area );
     return -1;
   }
 }
-- 
GitLab