-
Notifications
You must be signed in to change notification settings - Fork 236
Closed
Description
When the user sets CFE_PLATFORM_SB_HIGHEST_VALID_MSGID, the documentation specifies a range of 1 to 0xFFFF. This value is later used in a #define in cfe_sb_priv.h as follows:
#define CFE_SB_MAX_NUMBER_OF_MSG_KEYS (1+CFE_PLATFORM_SB_HIGHEST_VALID_MSGID)
This value is then used as the upper limit of a for loop here.
The problem is that if the user sets the upper limit of 0xFFFF as specified, the CFE_SB_MAX_NUMBER_OF_MSG_KEYS becomes 65536. This value is used as the upper range of the for loop linked above. Since the iterator used in that loop is a unsigned 16 bit integer, it can never reach 65536 and creates an infinite loop.
Suggested fix would be to:
- Stop using
#defines which add to other#defines - Never use
#defines as iterator range variables - Check types of all iterators
- Change the documentation of
CFE_PLATFORM_SB_HIGHEST_VALID_MSGIDto say max value of0xFFFE
Reactions are currently unavailable