From 14d642670e4c02b64bb5e005874a931aece30844 Mon Sep 17 00:00:00 2001 From: "tvisha.s.andharia" Date: Mon, 22 Jul 2024 16:35:26 -0400 Subject: [PATCH 1/2] Fix #2582, Cast to unsigned int --- modules/msg/fsw/src/cfe_msg_sechdr_time.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/msg/fsw/src/cfe_msg_sechdr_time.c b/modules/msg/fsw/src/cfe_msg_sechdr_time.c index d5d79d07a..8e3b8c7e0 100644 --- a/modules/msg/fsw/src/cfe_msg_sechdr_time.c +++ b/modules/msg/fsw/src/cfe_msg_sechdr_time.c @@ -92,8 +92,8 @@ CFE_Status_t CFE_MSG_GetMsgTime(const CFE_MSG_Message_t *MsgPtr, CFE_TIME_SysTim } /* Get big endian time fields with default 32/16 layout */ - Time->Subseconds = (tlm->Sec.Time[4] << 24) + (tlm->Sec.Time[5] << 16); - Time->Seconds = (tlm->Sec.Time[0] << 24) + (tlm->Sec.Time[1] << 16) + (tlm->Sec.Time[2] << 8) + tlm->Sec.Time[3]; + Time->Subseconds = ((unsigned int)tlm->Sec.Time[4] << 24) + ((unsigned int)tlm->Sec.Time[5] << 16); + Time->Seconds = ((unsigned int)tlm->Sec.Time[0] << 24) + ((unsigned int)tlm->Sec.Time[1] << 16) + ((unsigned int)tlm->Sec.Time[2] << 8) + (unsigned int)tlm->Sec.Time[3]; return CFE_SUCCESS; } From 66d44f56d2e4b8cda224e2b1e6bd5878b7869450 Mon Sep 17 00:00:00 2001 From: "tvisha.s.andharia" Date: Thu, 1 Aug 2024 14:47:21 -0400 Subject: [PATCH 2/2] Changing to uint32 cast --- modules/msg/fsw/src/cfe_msg_sechdr_time.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/msg/fsw/src/cfe_msg_sechdr_time.c b/modules/msg/fsw/src/cfe_msg_sechdr_time.c index 8e3b8c7e0..a0661ab87 100644 --- a/modules/msg/fsw/src/cfe_msg_sechdr_time.c +++ b/modules/msg/fsw/src/cfe_msg_sechdr_time.c @@ -92,8 +92,8 @@ CFE_Status_t CFE_MSG_GetMsgTime(const CFE_MSG_Message_t *MsgPtr, CFE_TIME_SysTim } /* Get big endian time fields with default 32/16 layout */ - Time->Subseconds = ((unsigned int)tlm->Sec.Time[4] << 24) + ((unsigned int)tlm->Sec.Time[5] << 16); - Time->Seconds = ((unsigned int)tlm->Sec.Time[0] << 24) + ((unsigned int)tlm->Sec.Time[1] << 16) + ((unsigned int)tlm->Sec.Time[2] << 8) + (unsigned int)tlm->Sec.Time[3]; + Time->Subseconds = ((uint32)tlm->Sec.Time[4] << 24) + ((uint32)tlm->Sec.Time[5] << 16); + Time->Seconds = ((uint32)tlm->Sec.Time[0] << 24) + ((uint32)tlm->Sec.Time[1] << 16) + ((uint32)tlm->Sec.Time[2] << 8) + (uint32)tlm->Sec.Time[3]; return CFE_SUCCESS; }