From ac6f5dceb0fb7ab3015d2ee34c7f4ef56d433500 Mon Sep 17 00:00:00 2001
From: Dong Anyuan <donganyuan@cn.fujitsu.com>
Date: Thu, 20 Jun 2019 11:28:22 +0900
Subject: [PATCH] Fix Coverity Scan CID 261499 (Overrunning array sqn_ms of 6
 bytes at byte offset 6 using index 6 - i (which evaluates to 6).)

---
 openair3/NAS/UE/API/USIM/usim_api.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/openair3/NAS/UE/API/USIM/usim_api.c b/openair3/NAS/UE/API/USIM/usim_api.c
index 7eb23be254..b882689f9b 100644
--- a/openair3/NAS/UE/API/USIM/usim_api.c
+++ b/openair3/NAS/UE/API/USIM/usim_api.c
@@ -409,7 +409,7 @@ int usim_api_authenticate(usim_data_t *usim_data, const OctetString* rand_pP, co
 
     //#define USIM_API_SQN_MS_SIZE  3
     printf("usim_data->usim_sqn.sqn_ms %p\n",usim_data->usim_sqn_data.sqn_ms);
-    for (i = 0; i < USIM_API_SQNMS_SIZE; i++) {
+    for (i = 1; i <= USIM_API_SQNMS_SIZE; i++) {
       //#warning "LG:BUG HERE TODO"
       printf("i %d:  ((uint8_t*)(usim_data->usim_sqn_data.sqn_ms))[USIM_API_SQNMS_SIZE - i] %d\n",i, ((uint8_t*)(usim_data->usim_sqn_data.sqn_ms))[USIM_API_SQNMS_SIZE - i]);
       sqn_ms[USIM_API_SQNMS_SIZE - i] =
-- 
GitLab