Skip to content

Commit c83933f

Browse files
authored
Merge pull request #130 from chillfig/SA_jsc2_1
Fix #127, Adds static analysis comments and replace strncpy with snprintf
2 parents ec96b02 + a5f1a8e commit c83933f

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

fsw/src/ds_app.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,7 @@ void DS_AppSendHkCmd(void)
358358
Status = CFE_TBL_GetInfo(&FilterTblInfo, FilterTblName);
359359
if (Status == CFE_SUCCESS)
360360
{
361-
strncpy(PayloadPtr->FilterTblFilename, FilterTblInfo.LastFileLoaded, OS_MAX_PATH_LEN - 1);
362-
PayloadPtr->FilterTblFilename[OS_MAX_PATH_LEN - 1] = '\0';
361+
snprintf(PayloadPtr->FilterTblFilename, OS_MAX_PATH_LEN, "%s", FilterTblInfo.LastFileLoaded);
363362
}
364363
else
365364
{

fsw/src/ds_appdefs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
#define DS_PATH_SEPARATOR '/' /**< \brief File system path separator */
4545

46-
#define DS_TABLE_VERIFY_ERR 0xFFFFFFFF /**< \brief Table verification error return value */
46+
#define DS_TABLE_VERIFY_ERR -1 /**< \brief Table verification error return value */
4747

4848
#define DS_FILE_HEADER_NONE 0 /**< \brief File header type is NONE */
4949
#define DS_FILE_HEADER_CFE 1 /**< \brief File header type is CFE */

fsw/src/ds_cmds.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,7 @@ void DS_GetFileInfoCmd(const CFE_SB_Buffer_t *BufPtr)
10961096
/*
10971097
** Set current open filename...
10981098
*/
1099-
strncpy(FileInfoPtr->FileName, DS_AppData.FileStatus[i].FileName, sizeof(FileInfoPtr->FileName));
1099+
snprintf(FileInfoPtr->FileName, sizeof(FileInfoPtr->FileName), "%s", DS_AppData.FileStatus[i].FileName);
11001100
}
11011101
}
11021102

fsw/src/ds_file.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ void DS_FileCloseDest(int32 FileIndex)
881881
}
882882

883883
/* Update the path name for reporting */
884-
strncpy(FileStatus->FileName, PathName, sizeof(FileStatus->FileName));
884+
snprintf(FileStatus->FileName, sizeof(FileStatus->FileName), "%s", PathName);
885885
}
886886
}
887887

@@ -991,7 +991,7 @@ void DS_FileTransmit(DS_AppFileStatus_t *FileStatus)
991991
/*
992992
** Set current open filename...
993993
*/
994-
strncpy(FileInfo->FileName, FileStatus->FileName, sizeof(FileInfo->FileName));
994+
snprintf(FileInfo->FileName, sizeof(FileInfo->FileName), "%s", FileStatus->FileName);
995995

996996
/*
997997
** Timestamp and send file info telemetry...

0 commit comments

Comments
 (0)