You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The CFE_PSP_ModuleCount value reflects the total number of entries (sum) of both lists.
But the CFE_PSP_Module_FindByName function is only searching the second list (GLOBAL_CONFIGDATA.PspModuleList). This means that if there is no matching entry, it might read beyond the end of the list.
To Reproduce
Call CFE_PSP_Module_FindByName on a module name that does not actually exist in the system. The loop will segfault when it gets to the NULL entry that normally terminates the GLOBAL_CONFIGDATA.PspModuleList.
Expected behavior
The search should cover CFE_PSP_BASE_MODULE_LIST and GLOBAL_CONFIGDATA.PspModuleList like the init function does
Code snips
Init function uses a helper function that does each list at:
Worth noting that this code in this file does NOT seem to have a coverage test for it ... this limit mismatch issue may have been caught by such a test.
Correct the CFE_PSP_Module_FindByName and CFE_PSP_Module_GetAPIEntry
lookups to use the correct length of the config data 'PspModuleList'.
The internal variable that had been used reflected the total across
two lists and thus was not a correct limit.
Rather than having these functions search both lists, this instead
keeps it to only exposing the user-specified modules in PspModuleList,
it does not expose the built-in/base modules. This makes the change
simpler, as typically the built in modules would not be accessed
through these functions at all.
Describe the bug
The internal variable
CFE_PSP_ModuleCount
is used as the limit for searching for a matching name in the PSP module list here:PSP/fsw/shared/src/cfe_psp_module.c
Line 127 in 15c2ced
However, a while back the set of modules was split into two, so now we have separate lists:
The
CFE_PSP_ModuleCount
value reflects the total number of entries (sum) of both lists.But the
CFE_PSP_Module_FindByName
function is only searching the second list (GLOBAL_CONFIGDATA.PspModuleList). This means that if there is no matching entry, it might read beyond the end of the list.To Reproduce
Call
CFE_PSP_Module_FindByName
on a module name that does not actually exist in the system. The loop will segfault when it gets to the NULL entry that normally terminates theGLOBAL_CONFIGDATA.PspModuleList
.Expected behavior
The search should cover
CFE_PSP_BASE_MODULE_LIST
andGLOBAL_CONFIGDATA.PspModuleList
like the init function doesCode snips
Init function uses a helper function that does each list at:
PSP/fsw/shared/src/cfe_psp_module.c
Lines 80 to 87 in 15c2ced
Search function should mirror this.
System observed on:
Ubuntu 22.04
Reporter Info
Joseph Hickey, Vantage Systems, Inc. on behalf of Alan Cudmore (GSFC)
The text was updated successfully, but these errors were encountered: