Skip to content

OSC_INUM_TO_IVEC stub returning stack allocated memory #777

@skliper

Description

@skliper

Is your feature request related to a problem? Please describe.
CodeQL warning on line 72 (returning VecTbl):

OCS_VOIDFUNCPTR *OCS_INUM_TO_IVEC(unsigned int ui)
{
int32 Status = UT_DEFAULT_IMPL(OCS_INUM_TO_IVEC);
OCS_VOIDFUNCPTR *VecTbl;
OCS_VOIDFUNCPTR DummyVec;
size_t VecTblSize;
if (Status == 0)
{
UT_GetDataBuffer(UT_KEY(OCS_INUM_TO_IVEC), (void **)&VecTbl, &VecTblSize, NULL);
if (VecTbl != NULL && ui < (VecTblSize / sizeof(OCS_VOIDFUNCPTR)))
{
VecTbl += ui;
}
else
{
DummyVec = &OCS_intLib_dummyfunc;
VecTbl = &DummyVec;
}
}
else
{
VecTbl = NULL;
}
return VecTbl;
}

Describe the solution you'd like
Make DummyVec static

Describe alternatives you've considered
Remove, no longer used in OSAL testing but could be used by PSP implementations. Leaving in for now.

Additional context
None

Requester Info
Jacob Hageman - NASA/GSFC

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsecurityunit-testTickets related to the OSAL unit testing (functional and/or coverage)

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions