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

Integration Candidate 2020-10-07 #936

Merged
merged 13 commits into from
Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update #899, Use sizeof() for output strings
Also check/ensure null termination of output
  • Loading branch information
jphickey authored and skliper committed Oct 2, 2020
commit 590025a294d6f608cb08904295a8a7903f78d663
10 changes: 5 additions & 5 deletions fsw/cfe-core/src/es/cfe_es_apps.c
Original file line number Diff line number Diff line change
Expand Up @@ -1531,9 +1531,9 @@ int32 CFE_ES_GetTaskInfoInternal(CFE_ES_TaskRecord_t *TaskRecPtr, CFE_ES_TaskInf
** Get the Application ID and Task Name
*/
TaskInfoPtr->AppId = TaskRecPtr->AppId;
strncpy((char *)TaskInfoPtr->TaskName,
(char *)TaskRecPtr->TaskName,OS_MAX_API_NAME);
TaskInfoPtr->TaskName[OS_MAX_API_NAME - 1] = '\0';
strncpy((char*)TaskInfoPtr->TaskName, TaskRecPtr->TaskName,
sizeof(TaskInfoPtr->TaskName)-1);
TaskInfoPtr->TaskName[sizeof(TaskInfoPtr->TaskName)-1] = '\0';

/*
** Store away the Task ID ( for the QueryAllTasks Cmd )
Expand All @@ -1551,9 +1551,9 @@ int32 CFE_ES_GetTaskInfoInternal(CFE_ES_TaskRecord_t *TaskRecPtr, CFE_ES_TaskInf
AppRecPtr = CFE_ES_LocateAppRecordByID(TaskRecPtr->AppId);
if (CFE_ES_AppRecordIsMatch(AppRecPtr, TaskRecPtr->AppId))
{
strncpy((char*)TaskInfoPtr->AppName,
(char*)AppRecPtr->StartParams.Name,
strncpy((char*)TaskInfoPtr->AppName, AppRecPtr->StartParams.Name,
sizeof(TaskInfoPtr->AppName)-1);
TaskInfoPtr->AppName[sizeof(TaskInfoPtr->AppName)-1] = '\0';
ReturnCode = CFE_SUCCESS;
}
else
Expand Down
2 changes: 1 addition & 1 deletion fsw/cfe-core/src/sb/cfe_sb_priv.c
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ char *CFE_SB_GetAppTskName(CFE_ES_ResourceID_t TaskId,char *FullName){
strncpy(FullName,"Unknown",OS_MAX_API_NAME-1);
FullName[OS_MAX_API_NAME-1] = '\0';

}else if(strncmp((char *)ptr->AppName,(char *)ptr->TaskName,OS_MAX_API_NAME-1) == 0){
}else if(strncmp((char *)ptr->AppName,(char *)ptr->TaskName,sizeof(ptr->AppName)) == 0){

/* if app name and task name are the same */
strncpy(FullName,(char *)ptr->AppName,OS_MAX_API_NAME-1);
Expand Down
4 changes: 3 additions & 1 deletion fsw/cfe-core/src/tbl/cfe_tbl_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1401,7 +1401,9 @@ int32 CFE_TBL_GetInfo( CFE_TBL_Info_t *TblInfoPtr, const char *TblName )
TblInfoPtr->FileCreateTimeSecs = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTimeSecs;
TblInfoPtr->FileCreateTimeSubSecs = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTimeSubSecs;
TblInfoPtr->Crc = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].Crc;
strncpy(TblInfoPtr->LastFileLoaded, RegRecPtr->LastFileLoaded, OS_MAX_PATH_LEN);
strncpy(TblInfoPtr->LastFileLoaded, RegRecPtr->LastFileLoaded,
sizeof(TblInfoPtr->LastFileLoaded)-1);
TblInfoPtr->LastFileLoaded[sizeof(TblInfoPtr->LastFileLoaded)-1] = 0;

/* Count the number of Access Descriptors to determine the number of users */
HandleIterator = RegRecPtr->HeadOfAccessList;
Expand Down