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

CFE_MSG_GetSize doesn't initialize size on failure - static analysis #1190

Closed
skliper opened this issue Mar 1, 2021 · 3 comments
Closed
Labels

Comments

@skliper
Copy link
Contributor

skliper commented Mar 1, 2021

Is your feature request related to a problem? Please describe.
Should initialize all output parameters:

int32 CFE_MSG_GetSize(const CFE_MSG_Message_t *MsgPtr, CFE_MSG_Size_t *Size)
{
if (MsgPtr == NULL || Size == NULL)
{
return CFE_MSG_BAD_ARGUMENT;
}

Describe the solution you'd like
Initialize to 0
Scrub MSG API's to ensure documentation and implementation comply (set all outputs, and define in documentation)

Describe alternatives you've considered
None

Additional context
Static analysis warning

Requester Info
Jacob Hageman - NASA/GSFC

@skliper
Copy link
Contributor Author

skliper commented Mar 1, 2021

Also - CFE_MSG_GetTypeFromMsgId and CFE_MSG_GetType... full scrub still needed (likely many "getters")

@skliper skliper added the CCB:Ready Ready for discussion at the Configuration Control Board (CCB) label Mar 17, 2021
@skliper
Copy link
Contributor Author

skliper commented Mar 17, 2021

Pending discussion on #1198 discussion, topic 2.

@skliper skliper added CCB:2021-03-17 and removed CCB:Ready Ready for discussion at the Configuration Control Board (CCB) labels Mar 17, 2021
@skliper
Copy link
Contributor Author

skliper commented Mar 17, 2021

CCB:2021-03-17 - this can be a hard pattern to follow and add complexity based on the error, not really an issue with the newer API's that return status. Less logic to initialize where needed in the calling function to squash static analysis warnings.

@skliper skliper closed this as completed Mar 17, 2021
@skliper skliper removed this from the 7.0.0 milestone Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant