-
Notifications
You must be signed in to change notification settings - Fork 202
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
Possible PortMessage buffer truncation #2529
Comments
This is actively happening in the bundle, see https://github.com/nasa/cFS/actions/runs/8971391786/artifacts/1476886717 for sample app, ci lab and to lab initialization messages. This ends up truncating the new line and makes the log harder to parse with long/clobbered lines:
I suggest checking for and replacing last two chars w/ Could also update the lab apps to not put out such a long msg, or increase the limit so the current messages fit. |
Marking as a bug due to it missing the new line, so the next message gets added on in the output which could be lost by automatic parsing tools that might expect events/sys log output to be on it's own line. It's also harder to skim visually. |
…e character truncation
Fix #2529, Reduces CFE_EVS_MAX_PORT_MSG_LENGTH to prevent new line character truncation
Is your feature request related to a problem? Please describe.
Data truncation is possible in the
snprintf()
belowcFE/modules/evs/fsw/src/cfe_evs_utils.c
Lines 548 to 551 in 5cffc39
Describe the solution you'd like
Appropriately allocate size for the message.
Describe alternatives you've considered
Leave as is. The possibility of truncating the message may be low given that AppName, for example, will not likely occupy the max 20 characters that it is allotted.
Additional context
This issue was flagged in JSC 2.1 static analysis.
TimeBuffer: 23 characters (excluding the null terminator)
Spacecraft ID: 10 characters (maximum length for uint32)
Processor ID: 10 characters (maximum length for uint32)
AppName: 20 characters (maximum given size)
Event ID: 5 characters (maximum length for uint16)
Message: 122 characters (maximum given size)
Exact non-data characters: 8 characters
The total exact maximum length is 23 + 10 + 10 + 20 + 5 + 122 + 8 = 198 characters needed, not counting the null terminator.
The defined length for CFE_EVS_MAX_PORT_MSG_LENGTH of 172
Requester Info
Justin Figueroa, Vantage
The text was updated successfully, but these errors were encountered: