Skip to content

Commit

Permalink
Fix #444, Adds JSC 2.1 Static Analysis comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jdfiguer authored and jdfiguer committed Jun 6, 2024
1 parent 12eff1c commit ac96459
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fsw/src/cf_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,19 +184,23 @@ CFE_Status_t CF_WriteHistoryEntryToFile(osal_id_t fd, const CF_History_t *histor
{
case 0:
CF_Assert(history->dir < CF_Direction_NUM);
/* SAD: Using snprintf since the buffer size is guaranteed to be sufficient for snprintf output */
snprintf(linebuf, sizeof(linebuf), "SEQ (%lu, %lu)\tDIR: %s\tPEER %lu\tSTAT: %d\t",
(unsigned long)history->src_eid, (unsigned long)history->seq_num, CF_DSTR[history->dir],
(unsigned long)history->peer_eid, (int)history->txn_stat);
break;
case 1:
/* SAD: Using snprintf since the buffer size is guaranteed to be sufficient for snprintf output */
snprintf(linebuf, sizeof(linebuf), "SRC: %s\t", history->fnames.src_filename);
break;
case 2:
default:
/* SAD: Using snprintf since the buffer size is guaranteed to be sufficient for snprintf output */
snprintf(linebuf, sizeof(linebuf), "DST: %s\n", history->fnames.dst_filename);
break;
}

/* SAD: Using strlen since linebuf is guaranteed to be null-terminated by snprintf */
len = strlen(linebuf);
ret = CF_WrappedWrite(fd, linebuf, len);
if (ret != len)
Expand Down

0 comments on commit ac96459

Please sign in to comment.