Skip to content

Commit

Permalink
Merge pull request #28 from skliper/fix9-ut_static_analysis
Browse files Browse the repository at this point in the history
Fix #8 #9, Resolve static analysis warnings
  • Loading branch information
astrogeco authored May 31, 2022
2 parents d076920 + 3c75063 commit 646332b
Show file tree
Hide file tree
Showing 8 changed files with 222 additions and 87 deletions.
2 changes: 2 additions & 0 deletions fsw/src/cs_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,8 @@ int32 CS_CreateRestoreStatesFromCDS(void)
int32 Result;
int32 EventId = 0;

memset(DataStoreBuffer, 0, sizeof(DataStoreBuffer));

/*
** Request for CDS area from cFE Executive Services...
*/
Expand Down
8 changes: 4 additions & 4 deletions fsw/src/cs_app_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ void CS_ReportBaselineAppCmd(const CS_AppNameCmd_t *CmdPtr)
/* Verify command packet length */
if (CS_VerifyCmdLength(&CmdPtr->CmdHeader.Msg, ExpectedLength))
{
strncpy(Name, CmdPtr->Name, sizeof(Name));
strncpy(Name, CmdPtr->Name, sizeof(Name) - 1);
Name[sizeof(Name) - 1] = '\0';

if (CS_GetAppResTblEntryByName(&ResultsEntry, Name))
Expand Down Expand Up @@ -166,7 +166,7 @@ void CS_RecomputeBaselineAppCmd(const CS_AppNameCmd_t *CmdPtr)
{
if (CS_AppData.HkPacket.RecomputeInProgress == false && CS_AppData.HkPacket.OneShotInProgress == false)
{
strncpy(Name, CmdPtr->Name, sizeof(Name));
strncpy(Name, CmdPtr->Name, sizeof(Name) - 1);
Name[sizeof(Name) - 1] = '\0';

/* make sure the entry is a valid number and is defined in the table */
Expand Down Expand Up @@ -234,7 +234,7 @@ void CS_DisableNameAppCmd(const CS_AppNameCmd_t *CmdPtr)
{
if (CS_CheckRecomputeOneshot() == false)
{
strncpy(Name, CmdPtr->Name, sizeof(Name));
strncpy(Name, CmdPtr->Name, sizeof(Name) - 1);
Name[sizeof(Name) - 1] = '\0';

if (CS_GetAppResTblEntryByName(&ResultsEntry, Name))
Expand Down Expand Up @@ -292,7 +292,7 @@ void CS_EnableNameAppCmd(const CS_AppNameCmd_t *CmdPtr)
{
if (CS_CheckRecomputeOneshot() == false)
{
strncpy(Name, CmdPtr->Name, sizeof(Name));
strncpy(Name, CmdPtr->Name, sizeof(Name) - 1);
Name[sizeof(Name) - 1] = '\0';

if (CS_GetAppResTblEntryByName(&ResultsEntry, Name))
Expand Down
8 changes: 4 additions & 4 deletions fsw/src/cs_table_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void CS_ReportBaselineTablesCmd(const CS_TableNameCmd_t *CmdPtr)
/* Verify command packet length */
if (CS_VerifyCmdLength(&CmdPtr->CmdHeader.Msg, ExpectedLength))
{
strncpy(Name, CmdPtr->Name, sizeof(Name));
strncpy(Name, CmdPtr->Name, sizeof(Name) - 1);
Name[sizeof(Name) - 1] = '\0';

if (CS_GetTableResTblEntryByName(&ResultsEntry, Name))
Expand Down Expand Up @@ -168,7 +168,7 @@ void CS_RecomputeBaselineTablesCmd(const CS_TableNameCmd_t *CmdPtr)

if (CS_AppData.HkPacket.RecomputeInProgress == false && CS_AppData.HkPacket.OneShotInProgress == false)
{
strncpy(Name, CmdPtr->Name, sizeof(Name));
strncpy(Name, CmdPtr->Name, sizeof(Name) - 1);
Name[sizeof(Name) - 1] = '\0';

/* make sure the entry is a valid number and is defined in the table */
Expand Down Expand Up @@ -236,7 +236,7 @@ void CS_DisableNameTablesCmd(const CS_TableNameCmd_t *CmdPtr)
{
if (CS_CheckRecomputeOneshot() == false)
{
strncpy(Name, CmdPtr->Name, sizeof(Name));
strncpy(Name, CmdPtr->Name, sizeof(Name) - 1);
Name[sizeof(Name) - 1] = '\0';

if (CS_GetTableResTblEntryByName(&ResultsEntry, Name))
Expand Down Expand Up @@ -293,7 +293,7 @@ void CS_EnableNameTablesCmd(const CS_TableNameCmd_t *CmdPtr)
{
if (CS_CheckRecomputeOneshot() == false)
{
strncpy(Name, CmdPtr->Name, sizeof(Name));
strncpy(Name, CmdPtr->Name, sizeof(Name) - 1);
Name[sizeof(Name) - 1] = '\0';

if (CS_GetTableResTblEntryByName(&ResultsEntry, Name))
Expand Down
Loading

0 comments on commit 646332b

Please sign in to comment.