diff --git a/fsw/src/ds_app.c b/fsw/src/ds_app.c index 9bd982b..4807f91 100644 --- a/fsw/src/ds_app.c +++ b/fsw/src/ds_app.c @@ -358,8 +358,7 @@ void DS_AppSendHkCmd(void) Status = CFE_TBL_GetInfo(&FilterTblInfo, FilterTblName); if (Status == CFE_SUCCESS) { - strncpy(PayloadPtr->FilterTblFilename, FilterTblInfo.LastFileLoaded, OS_MAX_PATH_LEN - 1); - PayloadPtr->FilterTblFilename[OS_MAX_PATH_LEN - 1] = '\0'; + snprintf(PayloadPtr->FilterTblFilename, OS_MAX_PATH_LEN, "%s", FilterTblInfo.LastFileLoaded); } else { diff --git a/fsw/src/ds_appdefs.h b/fsw/src/ds_appdefs.h index 01d950a..1b071c0 100644 --- a/fsw/src/ds_appdefs.h +++ b/fsw/src/ds_appdefs.h @@ -43,7 +43,7 @@ #define DS_PATH_SEPARATOR '/' /**< \brief File system path separator */ -#define DS_TABLE_VERIFY_ERR 0xFFFFFFFF /**< \brief Table verification error return value */ +#define DS_TABLE_VERIFY_ERR -1 /**< \brief Table verification error return value */ #define DS_FILE_HEADER_NONE 0 /**< \brief File header type is NONE */ #define DS_FILE_HEADER_CFE 1 /**< \brief File header type is CFE */ diff --git a/fsw/src/ds_cmds.c b/fsw/src/ds_cmds.c index 581f034..2efc26f 100644 --- a/fsw/src/ds_cmds.c +++ b/fsw/src/ds_cmds.c @@ -1096,7 +1096,7 @@ void DS_GetFileInfoCmd(const CFE_SB_Buffer_t *BufPtr) /* ** Set current open filename... */ - strncpy(FileInfoPtr->FileName, DS_AppData.FileStatus[i].FileName, sizeof(FileInfoPtr->FileName)); + snprintf(FileInfoPtr->FileName, sizeof(FileInfoPtr->FileName), "%s", DS_AppData.FileStatus[i].FileName); } } diff --git a/fsw/src/ds_file.c b/fsw/src/ds_file.c index fb9f31c..f302685 100644 --- a/fsw/src/ds_file.c +++ b/fsw/src/ds_file.c @@ -881,7 +881,7 @@ void DS_FileCloseDest(int32 FileIndex) } /* Update the path name for reporting */ - strncpy(FileStatus->FileName, PathName, sizeof(FileStatus->FileName)); + snprintf(FileStatus->FileName, sizeof(FileStatus->FileName), "%s", PathName); } } @@ -991,7 +991,7 @@ void DS_FileTransmit(DS_AppFileStatus_t *FileStatus) /* ** Set current open filename... */ - strncpy(FileInfo->FileName, FileStatus->FileName, sizeof(FileInfo->FileName)); + snprintf(FileInfo->FileName, sizeof(FileInfo->FileName), "%s", FileStatus->FileName); /* ** Timestamp and send file info telemetry... diff --git a/fsw/src/ds_table.c b/fsw/src/ds_table.c index 9643e9b..fc99fe2 100644 --- a/fsw/src/ds_table.c +++ b/fsw/src/ds_table.c @@ -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; } } @@ -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; } }