Skip to content

Commit

Permalink
Fix nasa#127, 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 10, 2024
1 parent ec96b02 commit f4a7227
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions fsw/src/ds_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ void DS_AppSendHkCmd(void)
Status = CFE_TBL_GetInfo(&FilterTblInfo, FilterTblName);
if (Status == CFE_SUCCESS)
{
/* SAD: Using OS_MAX_PATH_LEN - 1 ensures room for null termination. Explicit null terminator added at OS_MAX_PATH_LEN - 1 for safety */
strncpy(PayloadPtr->FilterTblFilename, FilterTblInfo.LastFileLoaded, OS_MAX_PATH_LEN - 1);
PayloadPtr->FilterTblFilename[OS_MAX_PATH_LEN - 1] = '\0';
}
Expand Down
1 change: 1 addition & 0 deletions fsw/src/ds_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,7 @@ void DS_GetFileInfoCmd(const CFE_SB_Buffer_t *BufPtr)
/*
** Set current open filename...
*/
/* SAD: Using strncpy since DS_AppData.FileStatus[i].FileName is null-terminated in ds/fsw/src/ds_file.c::DS_FileCreateName() */
strncpy(FileInfoPtr->FileName, DS_AppData.FileStatus[i].FileName, sizeof(FileInfoPtr->FileName));
}
}
Expand Down
2 changes: 2 additions & 0 deletions fsw/src/ds_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,7 @@ void DS_FileCloseDest(int32 FileIndex)
}

/* Update the path name for reporting */
/* SAD: Using strncpy since PathName is null-terminated in ds/fsw/src/ds_file.c::DS_FileCloseDest() */
strncpy(FileStatus->FileName, PathName, sizeof(FileStatus->FileName));
}
}
Expand Down Expand Up @@ -991,6 +992,7 @@ void DS_FileTransmit(DS_AppFileStatus_t *FileStatus)
/*
** Set current open filename...
*/
/* SAD: Using strncpy since FileStatus->FileName is null-terminated in ds/fsw/src/ds_file.c::DS_FileCreateName() */
strncpy(FileInfo->FileName, FileStatus->FileName, sizeof(FileInfo->FileName));

/*
Expand Down
2 changes: 2 additions & 0 deletions fsw/src/ds_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ CFE_Status_t DS_TableVerifyDestFile(const void *TableData)
else
{
CountBad++;
/* SAD: Assignment of 0xFFFFFFFF to Result is safe; it represents -1 in int32, within valid range */
Result = DS_TABLE_VERIFY_ERR;
}
}
Expand Down Expand Up @@ -543,6 +544,7 @@ CFE_Status_t DS_TableVerifyFilter(const void *TableData)
else
{
CountBad++;
/* SAD: Assignment of 0xFFFFFFFF to Result is safe; it represents -1 in int32, within valid range */
Result = DS_TABLE_VERIFY_ERR;
}
}
Expand Down

0 comments on commit f4a7227

Please sign in to comment.