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

Fix #65, Adds EventString null termination #69

Merged
merged 1 commit into from
Apr 18, 2023

Conversation

chillfig
Copy link
Contributor

@chillfig chillfig commented Apr 10, 2023

Checklist (Please check before submitting)

Describe the contribution
A clear and concise description of what the contribution is.

Testing performed

  • built app
  • Tested lcov
  • Ran passing cert_testbed::./runCTFscript.sh cFE_MM_DumpInEventRAM.json test

Expected behavior changes
Null terminated EventString

System(s) tested on

  • OS: Ubuntu 20.04

Additional context
Followed similar null-terminated character array concatenation in:https://github.com/nasa/DS/blob/64181647ab455653fbc04b20a43406764862673b/fsw/src/ds_file.c#L553

Third party code
If included, identify any third party code and provide text file of license

Contributor Info - All information REQUIRED for consideration of pull request

  • Justin Figueroa, Vantage

@chillfig chillfig self-assigned this Apr 10, 2023
fsw/src/mm_dump.c Fixed Show fixed Hide fixed
@chillfig chillfig force-pushed the NullTerminate_EventString branch 2 times, most recently from 48fae2d to 5ade791 Compare April 11, 2023 19:24
@@ -517,6 +518,7 @@ bool MM_DumpInEventCmd(const CFE_SB_Buffer_t *BufPtr)
** 13 characters, not counting NUL terminator
*/
strncpy(EventString, "Memory Dump: ", CFE_MISSION_EVS_MAX_MESSAGE_LENGTH);
Copy link
Contributor Author

@chillfig chillfig Apr 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Memory Dump: " may exceed length of CFE_MISSION_EVS_MAX_MESSAGE_LENGTH when CFE_MISSION_EVS_MAX_MESSAGE_LENGTH is configured less than size 14.

Ensure this is null terminated. Could just use CFE_SB_MessageStringGet()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Null termination of strings - static analysis audit
3 participants