Skip to content

Commit

Permalink
fix #687 - validate table handle prior to use
Browse files Browse the repository at this point in the history
  • Loading branch information
CDKnightNASA committed May 7, 2020
1 parent 8365a0c commit 4326e5d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions fsw/cfe-core/src/tbl/cfe_tbl_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,17 +675,20 @@ int32 CFE_TBL_Load( CFE_TBL_Handle_t TblHandle,
CFE_TBL_SrcEnum_t SrcType,
const void *SrcDataPtr )
{
int32 Status;
uint32 ThisAppId;
CFE_TBL_LoadBuff_t *WorkingBufferPtr;
CFE_TBL_AccessDescriptor_t *AccessDescPtr = &CFE_TBL_TaskData.Handles[TblHandle];
CFE_TBL_RegistryRec_t *RegRecPtr = &CFE_TBL_TaskData.Registry[AccessDescPtr->RegIndex];
char AppName[OS_MAX_API_NAME]={"UNKNOWN"};
int32 Status = 0;
uint32 ThisAppId = 0;
CFE_TBL_LoadBuff_t *WorkingBufferPtr = NULL;
CFE_TBL_AccessDescriptor_t *AccessDescPtr = NULL;
CFE_TBL_RegistryRec_t *RegRecPtr = NULL;
char AppName[OS_MAX_API_NAME] = {"UNKNOWN"};
bool FirstTime = false;

/* Verify access rights and get a valid Application ID for calling App */
Status = CFE_TBL_ValidateAccess(TblHandle, &ThisAppId);

AccessDescPtr = &CFE_TBL_TaskData.Handles[TblHandle];
RegRecPtr = &CFE_TBL_TaskData.Registry[AccessDescPtr->RegIndex];

/* Translate AppID of caller into App Name */
CFE_ES_GetAppName(AppName, ThisAppId, OS_MAX_API_NAME);

Expand Down

0 comments on commit 4326e5d

Please sign in to comment.