Skip to content

Commit

Permalink
Fix #79, Correct MsgId check
Browse files Browse the repository at this point in the history
Use the "CFE_SB_IsValidMsgId()" function to check msgids, as this
is the source of truth.
  • Loading branch information
jphickey committed Jan 22, 2024
1 parent e913f93 commit 9dc98bc
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
8 changes: 0 additions & 8 deletions cfecfs/edsmsg/fsw/src/cfe_msg_commonhdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,6 @@
#define CFE_MSG_SHDR_TYPE_TLM_BIT (CCSDS_SecHdrFlags_BareTlm & CCSDS_SecHdrFlags_Tlm)
#define CFE_MSG_SHDR_TYPE_CMD_BIT (CCSDS_SecHdrFlags_BareCmd & CCSDS_SecHdrFlags_Cmd)

#ifdef jphfix
CFE_MSG_Message_t *CFE_MSG_ConvertPtr(CFE_MSG_BaseMsg_t *BaseMsg)
{
void *Msg = BaseMsg;
return Msg;
}
#endif

/*----------------------------------------------------------------
*
* Function: CFE_MSG_GetHeaderVersion
Expand Down
2 changes: 1 addition & 1 deletion cfecfs/edsmsg/fsw/src/cfe_msg_msgid.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ CFE_Status_t CFE_MSG_SetMsgId(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId)
* not really a concept of a "highest" msg ID at all. However, for historical/backward
* compatibility reasons, this symbol is still defined in SB.
*/
if (MsgPtr == NULL || CFE_SB_MsgIdToValue(MsgId) > CFE_PLATFORM_SB_HIGHEST_VALID_MSGID)
if (MsgPtr == NULL || !CFE_SB_IsValidMsgId(MsgId))
{
return CFE_MSG_BAD_ARGUMENT;
}
Expand Down

0 comments on commit 9dc98bc

Please sign in to comment.