From 44abf7f5f9696794c67ba431d75795af2616499d Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 30 Jan 2020 15:29:48 -0500 Subject: [PATCH] Fix #487, CFE_TIME_print format fix: Cast and format - now int to avoid possible string buffer overflow --- fsw/cfe-core/ut-stubs/ut_time_stubs.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fsw/cfe-core/ut-stubs/ut_time_stubs.c b/fsw/cfe-core/ut-stubs/ut_time_stubs.c index b960487ab..495193646 100644 --- a/fsw/cfe-core/ut-stubs/ut_time_stubs.c +++ b/fsw/cfe-core/ut-stubs/ut_time_stubs.c @@ -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);