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

Incorrect check of status from CFE_SB_ReceiveBuffer() #73

Closed
jphickey opened this issue Dec 1, 2021 · 1 comment · Fixed by #75
Closed

Incorrect check of status from CFE_SB_ReceiveBuffer() #73

jphickey opened this issue Dec 1, 2021 · 1 comment · Fixed by #75
Assignees
Milestone

Comments

@jphickey
Copy link
Contributor

jphickey commented Dec 1, 2021

Checking of the status return from this CFE API call is not correct/sufficient:

CF/fsw/src/cf_cfdp.c

Lines 1365 to 1369 in 7b99b91

status = CFE_SB_ReceiveBuffer(&CF_AppData.engine.in.msg, c->pipe, CFE_SB_POLL);
if (status == CFE_SB_NO_MESSAGE)
{
break; /* no more messages */
}

This function may fail for a number of reasons, not limited to CFE_SB_NO_MESSAGE.

The preferred check should be:

if (status != CFE_SUCCESS)
@jphickey jphickey self-assigned this Dec 1, 2021
@jphickey jphickey added the bug label Dec 1, 2021
@jphickey
Copy link
Contributor Author

jphickey commented Dec 1, 2021

Note that if this fails for one of the other reasons, the output pointer is not set to a valid buffer. But CF code will proceed to access the (uninitialized) buffer, so this is a risk of undefined behavior/segfault/etc.

jphickey added a commit to jphickey/CF that referenced this issue Dec 1, 2021
Check generically for CFE_SUCCESS, rather than a single error code,
since there is more than one error.
jphickey added a commit to jphickey/CF that referenced this issue Dec 1, 2021
Check generically for CFE_SUCCESS, rather than a single error code,
since there is more than one error.
jphickey added a commit to jphickey/CF that referenced this issue Dec 1, 2021
Check generically for CFE_SUCCESS, rather than a single error code,
since there is more than one error.
astrogeco added a commit that referenced this issue Dec 8, 2021
Fix #73, correct status checks of CFE_SB_ReceiveBuffer
@skliper skliper added this to the Draco milestone Jan 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants