You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a possibility of an uninitialized variable in EVS_SendViaPorts in cue_evs_utils.c. I do not have a running example, problem found using static analysis with GrammaTech CodeSonar, screenshot attached.
Line 545 calls CFE_MSG_GetMsgTime(CFE_MSG_PTR(EVS_PktPtr->TelemetryHeader), &PktTime);
this function is in cue_msg_sechdr_time.c
however, if either the first, or the second parameter is NULL, then that function will return CFE_MSG_BAD_ARGUMENT on line 81 of that file. Second parameter is unlikely to be NULL as it is a pointer to a local variable from EVS_SendViaPorts().
Which means it does not initialize PktTime, which is subsequently used in the CFE_TIME_Print call.
This may not be a problem if the compiler initializes local variables to 0, but there is no guarantee on that.
PktTime is used in a time calculation to convert epoch to calendar time, so worst case this could take a long time, and/or print garbage.
Probably would be better to check the return of the call to CFE_MSG_GetMsgTime and set PktTime to 0 if CFE_MSG_BAD_ARGUMENT is returned.
The text was updated successfully, but these errors were encountered:
https://github.com/nasa/cFE/blob/e3b67674630cd098dbdefdc4e727c04a2b23dc31/modules/evs/fsw/src/cfe_evs_utils.c#LL545C3-L545C3
There is a possibility of an uninitialized variable in EVS_SendViaPorts in cue_evs_utils.c. I do not have a running example, problem found using static analysis with GrammaTech CodeSonar, screenshot attached.
Line 545 calls CFE_MSG_GetMsgTime(CFE_MSG_PTR(EVS_PktPtr->TelemetryHeader), &PktTime);
this function is in cue_msg_sechdr_time.c
however, if either the first, or the second parameter is NULL, then that function will return CFE_MSG_BAD_ARGUMENT on line 81 of that file. Second parameter is unlikely to be NULL as it is a pointer to a local variable from EVS_SendViaPorts().
Which means it does not initialize PktTime, which is subsequently used in the CFE_TIME_Print call.
This may not be a problem if the compiler initializes local variables to 0, but there is no guarantee on that.
PktTime is used in a time calculation to convert epoch to calendar time, so worst case this could take a long time, and/or print garbage.
Probably would be better to check the return of the call to CFE_MSG_GetMsgTime and set PktTime to 0 if CFE_MSG_BAD_ARGUMENT is returned.
The text was updated successfully, but these errors were encountered: