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

Apps should check/verify msg BEFORE calling handler #96

Closed
3 tasks done
havencarlson opened this issue Jun 28, 2023 · 0 comments · Fixed by #97
Closed
3 tasks done

Apps should check/verify msg BEFORE calling handler #96

havencarlson opened this issue Jun 28, 2023 · 0 comments · Fixed by #97

Comments

@havencarlson
Copy link
Contributor

Checklist (Please check before submitting)

  • I reviewed the Contributing Guide.
  • I reviewed the README file to see if the feature is in the major future work.
  • I performed a cursory search to see if the feature request is relevant, not redundant, nor in conflict with other tickets.

Is your feature request related to a problem? Please describe.
Copy of nasa/CS#75

The CFE core and sample app (which is supposed to be the example of "best practice") do validation on the message before calling the handler. For example:

case SAMPLE_APP_NOOP_CC:
    if (SAMPLE_APP_VerifyCmdLength(&SBBufPtr->Msg, sizeof(SAMPLE_APP_NoopCmd_t)))
    {
        SAMPLE_APP_Noop((SAMPLE_APP_NoopCmd_t *)SBBufPtr);
    }

This is different from SC, which does a similar check, but done inside each handler, for example:

SC/fsw/src/sc_cmds.c

Lines 498 to 506 in c7a3864

void SC_NoOpCmd(const CFE_SB_Buffer_t *BufPtr)
{
if (SC_VerifyCmdLength(&BufPtr->Msg, sizeof(SC_NoArgsCmd_t)))
{
SC_OperData.HkPacket.CmdCtr++;
CFE_EVS_SendEvent(SC_NOOP_INF_EID, CFE_EVS_EventType_INFORMATION, "No-op command. Version %d.%d.%d.%d",
SC_MAJOR_VERSION, SC_MINOR_VERSION, SC_REVISION, SC_MISSION_REV);
}
}

Describe the solution you'd like
CFS Apps should follow the best practices/patterns set forth in the framework code. (there are reasons for the pattern being recommended practice)

Requester Info
Haven Carlson - NASA

@havencarlson havencarlson self-assigned this Jun 28, 2023
havencarlson added a commit to havencarlson/SC that referenced this issue Jul 12, 2023
havencarlson added a commit to havencarlson/SC that referenced this issue Jul 12, 2023
havencarlson added a commit to havencarlson/SC that referenced this issue Jul 27, 2023
havencarlson added a commit to havencarlson/SC that referenced this issue Sep 1, 2023
havencarlson added a commit to havencarlson/SC that referenced this issue Sep 1, 2023
dzbaker added a commit that referenced this issue Sep 1, 2023
Fix #96, Moved command validation out of command functions
@chillfig chillfig added this to the Equuleus milestone Sep 5, 2023
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