Skip to content

Commit a4aa481

Browse files
authored
Merge pull request nasa#1098 from skliper/fix1089-clean_strncpy
Fix nasa#932 and nasa#1089, strncpy cleanup and UT updates for mission sizing of API_LEN and PATH_LEN
2 parents cc514bc + 26a0e06 commit a4aa481

20 files changed

+536
-428
lines changed

fsw/cfe-core/src/es/cfe_es_api.c

+7-6
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ int32 CFE_ES_GetAppName(char *AppName, CFE_ES_ResourceID_t AppId, size_t BufferL
871871
*/
872872
if (CFE_ES_AppRecordIsMatch(AppRecPtr, AppId))
873873
{
874-
strncpy(AppName, CFE_ES_AppRecordGetName(AppRecPtr), BufferLength);
874+
strncpy(AppName, CFE_ES_AppRecordGetName(AppRecPtr), BufferLength - 1);
875875
AppName[BufferLength - 1] = '\0';
876876
Result = CFE_SUCCESS;
877877
}
@@ -1306,8 +1306,8 @@ int32 CFE_ES_CreateChildTask(CFE_ES_ResourceID_t *TaskIdPtr,
13061306

13071307
CFE_ES_TaskRecordSetUsed(TaskRecPtr, ChildTaskId);
13081308
TaskRecPtr->AppId = CFE_ES_AppRecordGetID(AppRecPtr);
1309-
strncpy((char *)TaskRecPtr->TaskName,TaskName,OS_MAX_API_NAME);
1310-
TaskRecPtr->TaskName[OS_MAX_API_NAME - 1] = '\0';
1309+
strncpy(TaskRecPtr->TaskName,TaskName,sizeof(TaskRecPtr->TaskName) - 1);
1310+
TaskRecPtr->TaskName[sizeof(TaskRecPtr->TaskName) - 1] = '\0';
13111311
CFE_ES_Global.RegisteredTasks++;
13121312

13131313
*TaskIdPtr = ChildTaskId;
@@ -1737,8 +1737,8 @@ int32 CFE_ES_RegisterCDS(CFE_ES_CDSHandle_t *CDSHandlePtr, size_t BlockSize, con
17371737

17381738
/* Perform a buffer overrun safe copy of name for debug log message */
17391739

1740-
strncpy(CDSName, Name, CFE_MISSION_ES_CDS_MAX_NAME_LENGTH);
1741-
CDSName[CFE_MISSION_ES_CDS_MAX_NAME_LENGTH-1] = '\0';
1740+
strncpy(CDSName, Name, sizeof(CDSName) - 1);
1741+
CDSName[sizeof(CDSName) - 1] = '\0';
17421742
CFE_ES_WriteToSysLog("CFE_CDS:Register-CDS Name (%s) is too long\n", CDSName);
17431743
}
17441744
else
@@ -1925,7 +1925,8 @@ int32 CFE_ES_RegisterGenCounter(CFE_ES_ResourceID_t *CounterIdPtr, const char *C
19251925
else
19261926
{
19271927
strncpy(CountRecPtr->CounterName,CounterName,
1928-
sizeof(CountRecPtr->CounterName));
1928+
sizeof(CountRecPtr->CounterName) - 1);
1929+
CountRecPtr->CounterName[sizeof(CountRecPtr->CounterName) - 1] = '\0';
19291930
CountRecPtr->Counter = 0;
19301931
CFE_ES_CounterRecordSetUsed(CountRecPtr, PendingCounterId);
19311932
CFE_ES_Global.LastCounterId = PendingCounterId;

fsw/cfe-core/src/es/cfe_es_apps.c

+7
Original file line numberDiff line numberDiff line change
@@ -707,12 +707,16 @@ int32 CFE_ES_AppCreate(CFE_ES_ResourceID_t *ApplicationIdPtr,
707707
AppRecPtr->Type = CFE_ES_AppType_EXTERNAL;
708708
strncpy(AppRecPtr->StartParams.BasicInfo.Name, AppName,
709709
sizeof(AppRecPtr->StartParams.BasicInfo.Name)-1);
710+
AppRecPtr->StartParams.BasicInfo.Name[sizeof(AppRecPtr->StartParams.BasicInfo.Name)-1] = '\0';
710711
strncpy(AppRecPtr->StartParams.BasicInfo.FileName, FileName,
711712
sizeof(AppRecPtr->StartParams.BasicInfo.FileName)-1);
713+
AppRecPtr->StartParams.BasicInfo.FileName[sizeof(AppRecPtr->StartParams.BasicInfo.FileName)-1] = '\0';
712714
if (EntryPointName != NULL && strcmp(EntryPointName, "NULL") != 0)
713715
{
714716
strncpy(AppRecPtr->StartParams.BasicInfo.EntryPoint, EntryPointName,
715717
sizeof(AppRecPtr->StartParams.BasicInfo.EntryPoint)-1);
718+
AppRecPtr->StartParams.BasicInfo.EntryPoint[
719+
sizeof(AppRecPtr->StartParams.BasicInfo.EntryPoint)-1] = '\0';
716720
}
717721

718722
AppRecPtr->StartParams.StackSize = StackSize;
@@ -883,12 +887,15 @@ int32 CFE_ES_LoadLibrary(CFE_ES_ResourceID_t *LibraryIdPtr,
883887
*/
884888
strncpy(LibSlotPtr->BasicInfo.Name, LibName,
885889
sizeof(LibSlotPtr->BasicInfo.Name)-1);
890+
LibSlotPtr->BasicInfo.Name[sizeof(LibSlotPtr->BasicInfo.Name)-1] = '\0';
886891
strncpy(LibSlotPtr->BasicInfo.FileName, FileName,
887892
sizeof(LibSlotPtr->BasicInfo.FileName)-1);
893+
LibSlotPtr->BasicInfo.FileName[sizeof(LibSlotPtr->BasicInfo.FileName)-1] = '\0';
888894
if (EntryPointName != NULL && strcmp(EntryPointName, "NULL") != 0)
889895
{
890896
strncpy(LibSlotPtr->BasicInfo.EntryPoint, EntryPointName,
891897
sizeof(LibSlotPtr->BasicInfo.EntryPoint)-1);
898+
LibSlotPtr->BasicInfo.EntryPoint[sizeof(LibSlotPtr->BasicInfo.EntryPoint)-1] = '\0';
892899
}
893900

894901
CFE_ES_LibRecordSetUsed(LibSlotPtr, CFE_ES_RESOURCEID_RESERVED);

fsw/cfe-core/src/es/cfe_es_erlog.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ int32 CFE_ES_WriteToERLogWithContext( CFE_ES_LogEntryType_Enum_t EntryType, ui
139139
/*
140140
** Copy the Description string to the log.
141141
*/
142-
strncpy(EntryPtr->BaseInfo.Description, Description, sizeof(EntryPtr->BaseInfo.Description));
142+
strncpy(EntryPtr->BaseInfo.Description, Description, sizeof(EntryPtr->BaseInfo.Description) - 1);
143+
EntryPtr->BaseInfo.Description[sizeof(EntryPtr->BaseInfo.Description) - 1] = '\0';
143144

144145
/*
145146
* Store the context info (if any)

fsw/cfe-core/src/es/cfe_es_start.c

+1
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,7 @@ void CFE_ES_CreateObjects(void)
769769
AppRecPtr->Type = CFE_ES_AppType_CORE;
770770
strncpy(AppRecPtr->StartParams.BasicInfo.Name, CFE_ES_ObjectTable[i].ObjectName,
771771
sizeof(AppRecPtr->StartParams.BasicInfo.Name)-1);
772+
AppRecPtr->StartParams.BasicInfo.Name[sizeof(AppRecPtr->StartParams.BasicInfo.Name)-1] = '\0';
772773

773774
/* FileName and EntryPoint is not valid for core apps */
774775
AppRecPtr->StartParams.StackSize = CFE_ES_ObjectTable[i].ObjectSize;

fsw/cfe-core/src/es/cfe_es_task.c

+3-12
Original file line numberDiff line numberDiff line change
@@ -216,15 +216,6 @@ int32 CFE_ES_TaskInit(void)
216216
CFE_ES_TaskData.CommandCounter = 0;
217217
CFE_ES_TaskData.CommandErrorCounter = 0;
218218

219-
/*
220-
** Initialize task configuration data
221-
*/
222-
strcpy(CFE_ES_TaskData.PipeName, "ES_CMD_PIPE");
223-
CFE_ES_TaskData.PipeDepth = 12;
224-
225-
CFE_ES_TaskData.LimitHK = 2;
226-
CFE_ES_TaskData.LimitCmd = 4;
227-
228219
/*
229220
** Initialize systemlog to default Power On or Processor Reset mode
230221
*/
@@ -271,7 +262,7 @@ int32 CFE_ES_TaskInit(void)
271262
/*
272263
** Create Software Bus message pipe
273264
*/
274-
Status = CFE_SB_CreatePipe(&CFE_ES_TaskData.CmdPipe, CFE_ES_TaskData.PipeDepth, CFE_ES_TaskData.PipeName);
265+
Status = CFE_SB_CreatePipe(&CFE_ES_TaskData.CmdPipe, CFE_ES_PIPE_DEPTH, CFE_ES_PIPE_NAME);
275266
if ( Status != CFE_SUCCESS )
276267
{
277268
CFE_ES_WriteToSysLog("ES:Cannot Create SB Pipe, RC = 0x%08X\n", (unsigned int)Status);
@@ -282,7 +273,7 @@ int32 CFE_ES_TaskInit(void)
282273
** Subscribe to Housekeeping request commands
283274
*/
284275
Status = CFE_SB_SubscribeEx(CFE_SB_ValueToMsgId(CFE_ES_SEND_HK_MID), CFE_ES_TaskData.CmdPipe,
285-
CFE_SB_Default_Qos, CFE_ES_TaskData.LimitHK);
276+
CFE_SB_Default_Qos, CFE_ES_LIMIT_HK);
286277
if ( Status != CFE_SUCCESS )
287278
{
288279
CFE_ES_WriteToSysLog("ES:Cannot Subscribe to HK packet, RC = 0x%08X\n", (unsigned int)Status);
@@ -293,7 +284,7 @@ int32 CFE_ES_TaskInit(void)
293284
** Subscribe to ES task ground command packets
294285
*/
295286
Status = CFE_SB_SubscribeEx(CFE_SB_ValueToMsgId(CFE_ES_CMD_MID), CFE_ES_TaskData.CmdPipe,
296-
CFE_SB_Default_Qos, CFE_ES_TaskData.LimitCmd);
287+
CFE_SB_Default_Qos, CFE_ES_LIMIT_CMD);
297288
if ( Status != CFE_SUCCESS )
298289
{
299290
CFE_ES_WriteToSysLog("ES:Cannot Subscribe to ES ground commands, RC = 0x%08X\n", (unsigned int)Status);

fsw/cfe-core/src/es/cfe_es_task.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@
4747

4848
/*************************************************************************/
4949

50+
#define CFE_ES_PIPE_NAME "ES_CMD_PIPE"
51+
#define CFE_ES_PIPE_DEPTH 12
52+
#define CFE_ES_LIMIT_HK 2
53+
#define CFE_ES_LIMIT_CMD 4
54+
5055
/*
5156
** ES File descriptions
5257
*/
@@ -123,9 +128,6 @@ typedef struct
123128
/*
124129
** ES Task initialization data (not reported in housekeeping)
125130
*/
126-
char PipeName[OS_MAX_API_NAME];
127-
uint16 PipeDepth;
128-
129131
uint8 LimitHK;
130132
uint8 LimitCmd;
131133

fsw/cfe-core/src/sb/cfe_sb_priv.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -346,10 +346,10 @@ char *CFE_SB_GetAppTskName(CFE_ES_ResourceID_t TaskId,char *FullName){
346346
}else{
347347

348348
/* AppName and TskName buffers and strncpy are needed to limit string sizes */
349-
strncpy(AppName,(char *)ptr->AppName,OS_MAX_API_NAME-1);
350-
AppName[OS_MAX_API_NAME-1] = '\0';
351-
strncpy(TskName,(char *)ptr->TaskName,OS_MAX_API_NAME-1);
352-
TskName[OS_MAX_API_NAME-1] = '\0';
349+
strncpy(AppName,(char *)ptr->AppName,sizeof(AppName)-1);
350+
AppName[sizeof(AppName)-1] = '\0';
351+
strncpy(TskName,(char *)ptr->TaskName,sizeof(TskName)-1);
352+
TskName[sizeof(TskName)-1] = '\0';
353353

354354
sprintf(FullName,"%s.%s",AppName,TskName);
355355

fsw/cfe-core/src/tbl/cfe_tbl_api.c

+17-10
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr,
8181
Status = CFE_TBL_ERR_INVALID_NAME;
8282

8383
/* Perform a buffer overrun safe copy of name for debug log message */
84-
strncpy(TblName, Name, CFE_MISSION_TBL_MAX_NAME_LENGTH);
85-
TblName[CFE_MISSION_TBL_MAX_NAME_LENGTH-1] = '\0';
84+
strncpy(TblName, Name, sizeof(TblName) - 1);
85+
TblName[sizeof(TblName) - 1] = '\0';
8686
CFE_ES_WriteToSysLog("CFE_TBL:Register-Table Name (%s) is bad length (%d)",TblName,(int)NameLen);
8787
}
8888
else
@@ -314,7 +314,8 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr,
314314
RegRecPtr->ValidationFuncPtr = TblValidationFuncPtr;
315315

316316
/* Save Table Name in Registry */
317-
strncpy(RegRecPtr->Name, TblName, CFE_TBL_MAX_FULL_NAME_LEN);
317+
strncpy(RegRecPtr->Name, TblName, sizeof(RegRecPtr->Name) - 1);
318+
RegRecPtr->Name[sizeof(RegRecPtr->Name) - 1] = '\0';
318319

319320
/* Set the "Dump Only" flag to value based upon selected option */
320321
if ((TblOptionFlags & CFE_TBL_OPT_LD_DMP_MSK) == CFE_TBL_OPT_DUMP_ONLY)
@@ -398,10 +399,14 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr,
398399

399400
if ((CritRegRecPtr != NULL) && (CritRegRecPtr->TableLoadedOnce))
400401
{
401-
strncpy(WorkingBufferPtr->DataSource, CritRegRecPtr->LastFileLoaded, OS_MAX_PATH_LEN);
402+
strncpy(WorkingBufferPtr->DataSource, CritRegRecPtr->LastFileLoaded,
403+
sizeof(WorkingBufferPtr->DataSource) - 1);
404+
WorkingBufferPtr->DataSource[sizeof(WorkingBufferPtr->DataSource) - 1] = '\0';
402405
WorkingBufferPtr->FileCreateTimeSecs = CritRegRecPtr->FileCreateTimeSecs;
403406
WorkingBufferPtr->FileCreateTimeSubSecs = CritRegRecPtr->FileCreateTimeSubSecs;
404-
strncpy(RegRecPtr->LastFileLoaded, CritRegRecPtr->LastFileLoaded, OS_MAX_PATH_LEN);
407+
strncpy(RegRecPtr->LastFileLoaded, CritRegRecPtr->LastFileLoaded,
408+
sizeof(RegRecPtr->LastFileLoaded) - 1);
409+
RegRecPtr->LastFileLoaded[sizeof(RegRecPtr->LastFileLoaded) - 1] = '\0';
405410
RegRecPtr->TimeOfLastUpdate.Seconds = CritRegRecPtr->TimeOfLastUpdate.Seconds;
406411
RegRecPtr->TimeOfLastUpdate.Subseconds = CritRegRecPtr->TimeOfLastUpdate.Subseconds;
407412
RegRecPtr->TableLoadedOnce = CritRegRecPtr->TableLoadedOnce;
@@ -441,7 +446,8 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr,
441446
if (CritRegRecPtr != NULL)
442447
{
443448
CritRegRecPtr->CDSHandle = RegRecPtr->CDSHandle;
444-
strncpy(CritRegRecPtr->Name, TblName, CFE_TBL_MAX_FULL_NAME_LEN);
449+
strncpy(CritRegRecPtr->Name, TblName, sizeof(CritRegRecPtr->Name) - 1);
450+
CritRegRecPtr->Name[sizeof(CritRegRecPtr->Name) - 1] = '\0';
445451
CritRegRecPtr->FileCreateTimeSecs = 0;
446452
CritRegRecPtr->FileCreateTimeSubSecs = 0;
447453
CritRegRecPtr->LastFileLoaded[0] = '\0';
@@ -874,7 +880,8 @@ int32 CFE_TBL_Load( CFE_TBL_Handle_t TblHandle,
874880
/* On initial loads, make sure registry is given file/address of data source */
875881
strncpy(RegRecPtr->LastFileLoaded,
876882
WorkingBufferPtr->DataSource,
877-
OS_MAX_PATH_LEN);
883+
sizeof(RegRecPtr->LastFileLoaded) - 1);
884+
RegRecPtr->LastFileLoaded[sizeof(RegRecPtr->LastFileLoaded) - 1] = '\0';
878885

879886
CFE_TBL_NotifyTblUsersOfUpdate(RegRecPtr);
880887

@@ -1494,7 +1501,7 @@ int32 CFE_TBL_Modified( CFE_TBL_Handle_t TblHandle )
14941501

14951502
/* Keep a record of change for the ground operators reference */
14961503
RegRecPtr->TimeOfLastUpdate = CFE_TIME_GetTime();
1497-
RegRecPtr->LastFileLoaded[OS_MAX_PATH_LEN-1] = '\0';
1504+
RegRecPtr->LastFileLoaded[sizeof(RegRecPtr->LastFileLoaded)-1] = '\0';
14981505

14991506
/* Update CRC on contents of table */
15001507
RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].Crc =
@@ -1504,13 +1511,13 @@ int32 CFE_TBL_Modified( CFE_TBL_Handle_t TblHandle )
15041511
CFE_MISSION_ES_DEFAULT_CRC);
15051512

15061513
FilenameLen = strlen(RegRecPtr->LastFileLoaded);
1507-
if (FilenameLen < (OS_MAX_PATH_LEN-4))
1514+
if (FilenameLen < (sizeof(RegRecPtr->LastFileLoaded)-4))
15081515
{
15091516
strncpy(&RegRecPtr->LastFileLoaded[FilenameLen], "(*)", 4);
15101517
}
15111518
else
15121519
{
1513-
strncpy(&RegRecPtr->LastFileLoaded[(OS_MAX_PATH_LEN-4)], "(*)", 4);
1520+
strncpy(&RegRecPtr->LastFileLoaded[sizeof(RegRecPtr->LastFileLoaded)-4], "(*)", 4);
15141521
}
15151522

15161523
AccessIterator = RegRecPtr->HeadOfAccessList;

fsw/cfe-core/src/tbl/cfe_tbl_internal.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -1002,8 +1002,8 @@ int32 CFE_TBL_LoadFromFile(const char *AppName, CFE_TBL_LoadBuff_t *WorkingBuffe
10021002
return CFE_TBL_ERR_FILE_TOO_LARGE;
10031003
}
10041004

1005-
memset(WorkingBufferPtr->DataSource, 0, OS_MAX_PATH_LEN);
1006-
strncpy(WorkingBufferPtr->DataSource, Filename, OS_MAX_PATH_LEN);
1005+
memset(WorkingBufferPtr->DataSource, 0, sizeof(WorkingBufferPtr->DataSource));
1006+
strncpy(WorkingBufferPtr->DataSource, Filename, sizeof(WorkingBufferPtr->DataSource) - 1);
10071007

10081008
/* Save file creation time for later storage into Registry */
10091009
WorkingBufferPtr->FileCreateTimeSecs = StdFileHeader.TimeSeconds;
@@ -1054,7 +1054,8 @@ int32 CFE_TBL_UpdateInternal( CFE_TBL_Handle_t TblHandle,
10541054
/* However, we need to copy it into active registry area */
10551055
strncpy(RegRecPtr->LastFileLoaded,
10561056
RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].DataSource,
1057-
OS_MAX_PATH_LEN);
1057+
sizeof(RegRecPtr->LastFileLoaded) - 1);
1058+
RegRecPtr->LastFileLoaded[sizeof(RegRecPtr->LastFileLoaded) - 1] = '\0';
10581059

10591060
CFE_TBL_NotifyTblUsersOfUpdate(RegRecPtr);
10601061

@@ -1470,7 +1471,8 @@ void CFE_TBL_UpdateCriticalTblCDS(CFE_TBL_RegistryRec_t *RegRecPtr)
14701471
/* Save information related to the source of the data stored in the table in Critical Table Registry */
14711472
CritRegRecPtr->FileCreateTimeSecs = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTimeSecs;
14721473
CritRegRecPtr->FileCreateTimeSubSecs = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTimeSubSecs;
1473-
strncpy(CritRegRecPtr->LastFileLoaded, RegRecPtr->LastFileLoaded, OS_MAX_PATH_LEN);
1474+
strncpy(CritRegRecPtr->LastFileLoaded, RegRecPtr->LastFileLoaded, sizeof(CritRegRecPtr->LastFileLoaded) - 1);
1475+
CritRegRecPtr->LastFileLoaded[sizeof(CritRegRecPtr->LastFileLoaded) - 1] = '\0';
14741476
CritRegRecPtr->TimeOfLastUpdate = RegRecPtr->TimeOfLastUpdate;
14751477
CritRegRecPtr->TableLoadedOnce = RegRecPtr->TableLoadedOnce;
14761478

fsw/cfe-core/src/tbl/cfe_tbl_task.c

+1-7
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,7 @@ int32 CFE_TBL_TaskInit(void)
181181
/*
182182
** Create Software Bus message pipe
183183
*/
184-
Status = CFE_SB_CreatePipe(&CFE_TBL_TaskData.CmdPipe,
185-
CFE_TBL_TaskData.PipeDepth,
186-
CFE_TBL_TaskData.PipeName);
184+
Status = CFE_SB_CreatePipe(&CFE_TBL_TaskData.CmdPipe, CFE_TBL_TASK_PIPE_DEPTH, CFE_TBL_TASK_PIPE_NAME);
187185
if(Status != CFE_SUCCESS)
188186
{
189187
CFE_ES_WriteToSysLog("TBL:Error creating cmd pipe:RC=0x%08X\n",(unsigned int)Status);
@@ -241,10 +239,6 @@ void CFE_TBL_InitData(void)
241239
/* Get the assigned Application ID for the Table Services Task */
242240
CFE_ES_GetAppID(&CFE_TBL_TaskData.TableTaskAppId);
243241

244-
/* Initialize Command Pipe Parameters */
245-
CFE_TBL_TaskData.PipeDepth = CFE_TBL_TASK_PIPE_DEPTH;
246-
strncpy(CFE_TBL_TaskData.PipeName, CFE_TBL_TASK_PIPE_NAME, 16);
247-
248242
/* Initialize Packet Headers */
249243
CFE_MSG_Init(&CFE_TBL_TaskData.HkPacket.TlmHeader.Msg,
250244
CFE_SB_ValueToMsgId(CFE_TBL_HK_TLM_MID),

fsw/cfe-core/src/tbl/cfe_tbl_task.h

-2
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,6 @@ typedef struct
313313
/*
314314
** Task initialization data (not reported in housekeeping)...
315315
*/
316-
char PipeName[16]; /**< \brief Contains name of Table Task command pipe */
317-
uint16 PipeDepth; /**< \brief Contains depth of Table Task command pipe */
318316
CFE_ES_ResourceID_t TableTaskAppId; /**< \brief Contains Table Task Application ID as assigned by OS AL */
319317

320318
int16 HkTlmTblRegIndex; /**< \brief Index of table registry entry to be telemetered with Housekeeping */

fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -484,9 +484,13 @@ int32 CFE_TBL_LoadCmd(const CFE_TBL_LoadCmd_t *data)
484484

485485
/* Save file information statistics for housekeeping telemetry */
486486
strncpy(CFE_TBL_TaskData.HkPacket.Payload.LastFileLoaded, LoadFilename,
487-
sizeof(CFE_TBL_TaskData.HkPacket.Payload.LastFileLoaded));
487+
sizeof(CFE_TBL_TaskData.HkPacket.Payload.LastFileLoaded) - 1);
488+
CFE_TBL_TaskData.HkPacket.Payload.LastFileLoaded[
489+
sizeof(CFE_TBL_TaskData.HkPacket.Payload.LastFileLoaded) - 1] = '\0';
488490
strncpy(CFE_TBL_TaskData.HkPacket.Payload.LastTableLoaded, TblFileHeader.TableName,
489-
sizeof(CFE_TBL_TaskData.HkPacket.Payload.LastTableLoaded));
491+
sizeof(CFE_TBL_TaskData.HkPacket.Payload.LastTableLoaded) - 1);
492+
CFE_TBL_TaskData.HkPacket.Payload.LastTableLoaded[
493+
sizeof(CFE_TBL_TaskData.HkPacket.Payload.LastTableLoaded) - 1] = '\0';
490494

491495
/* Increment successful command completion counter */
492496
ReturnCode = CFE_TBL_INC_CMD_CTR;

fsw/cfe-core/src/time/cfe_time_task.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,7 @@ int32 CFE_TIME_TaskInit(void)
265265
}/* end if */
266266

267267

268-
Status = CFE_SB_CreatePipe(&CFE_TIME_TaskData.CmdPipe,
269-
CFE_TIME_TaskData.PipeDepth,
270-
CFE_TIME_TaskData.PipeName);
268+
Status = CFE_SB_CreatePipe(&CFE_TIME_TaskData.CmdPipe, CFE_TIME_TASK_PIPE_DEPTH, CFE_TIME_TASK_PIPE_NAME);
271269
if(Status != CFE_SUCCESS)
272270
{
273271
CFE_ES_WriteToSysLog("TIME:Error creating cmd pipe:RC=0x%08X\n",(unsigned int)Status);

fsw/cfe-core/src/time/cfe_time_utils.c

-3
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,6 @@ void CFE_TIME_InitData(void)
256256
/*
257257
** Initialize task configuration data...
258258
*/
259-
strcpy(CFE_TIME_TaskData.PipeName, CFE_TIME_TASK_PIPE_NAME);
260-
CFE_TIME_TaskData.PipeDepth = CFE_TIME_TASK_PIPE_DEPTH;
261-
262259
memset((void*)CFE_TIME_TaskData.ReferenceState, 0, sizeof(CFE_TIME_TaskData.ReferenceState));
263260
for (i = 0; i < CFE_TIME_REFERENCE_BUF_DEPTH; ++i)
264261
{

fsw/cfe-core/src/time/cfe_time_utils.h

-3
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,6 @@ typedef struct
188188
/*
189189
** Task initialization data (not reported in housekeeping)...
190190
*/
191-
char PipeName[16];
192-
uint16 PipeDepth;
193-
194191
int16 ClockSource;
195192
int16 ClockSignal;
196193
int16 ServerFlyState;

0 commit comments

Comments
 (0)