diff --git a/modules/evs/fsw/src/cfe_evs_utils.c b/modules/evs/fsw/src/cfe_evs_utils.c index de93e565f..d07c2b3e4 100644 --- a/modules/evs/fsw/src/cfe_evs_utils.c +++ b/modules/evs/fsw/src/cfe_evs_utils.c @@ -393,8 +393,11 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1 ExpandedLength = vsnprintf((char *)LongEventTlm.Payload.Message, sizeof(LongEventTlm.Payload.Message), MsgSpec, ArgPtr); - /* Were any characters truncated in the buffer? */ - if (ExpandedLength >= sizeof(LongEventTlm.Payload.Message)) + /* + * If vsnprintf is bigger than message size, mark with truncation character + * Note negative returns (error from vsnprintf) willl just leave the message empty + */ + if (ExpandedLength >= (int)sizeof(LongEventTlm.Payload.Message)) { /* Mark character before zero terminator to indicate truncation */ LongEventTlm.Payload.Message[sizeof(LongEventTlm.Payload.Message) - 2] = CFE_EVS_MSG_TRUNCATED;