Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #8 #9, Resolve static analysis warnings #28

Merged
merged 2 commits into from
May 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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