Skip to content

Commit

Permalink
Fix nasa#487, CFE_TIME_print format fix: Cast and format -
Browse files Browse the repository at this point in the history
now int to avoid possible string buffer overflow
  • Loading branch information
dmknutsen committed Feb 25, 2020
1 parent 3356da6 commit 44abf7f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions fsw/cfe-core/ut-stubs/ut_time_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,10 @@ void CFE_TIME_TaskMain(void)
void CFE_TIME_Print(char *PrintBuffer, CFE_TIME_SysTime_t TimeToPrint)
{
snprintf(PrintBuffer,
CFE_TIME_PRINTED_STRING_SIZE,
"UT %lu.%lu -",
(unsigned long)TimeToPrint.Seconds,
(unsigned long)TimeToPrint.Subseconds);

CFE_TIME_PRINTED_STRING_SIZE,
"UT %u.%u -",
(unsigned int)TimeToPrint.Seconds,
(unsigned int)TimeToPrint.Subseconds);

UT_Stub_RegisterContext(UT_KEY(CFE_TIME_Print), PrintBuffer);
UT_Stub_RegisterContext(UT_KEY(CFE_TIME_Print), &TimeToPrint);
Expand Down

0 comments on commit 44abf7f

Please sign in to comment.