CF
CF copied to clipboard
CF writes to received SB buffer
Checklist (Please check before submitting)
- [x] I reviewed the Contributing Guide.
- [x] I performed a cursory search to see if the bug report is relevant, not redundant, nor in conflict with other tickets.
Describe the bug
The output from CFE_SB_ReceiveBuffer()
is a pointer to a shared buffer, and thus should be interpreted as const
data. The only reason it is not qualified const
in the API was due to backward compatibility concerns.
However, CF is actually writing to the buffer in two places.
To Reproduce Send those commands
Expected behavior Should not write to a buffer that was received from SB
Code snips https://github.com/nasa/CF/blob/a0d35e1d7cc822952e18535b195a302a1d59a64c/fsw/src/cf_cmd.c#L147-L149 https://github.com/nasa/CF/blob/a0d35e1d7cc822952e18535b195a302a1d59a64c/fsw/src/cf_cmd.c#L190-L192
System observed on: Inspection
Additional context This is done to ensure null termination of the string. While a valid concern, a function like CFE_SB_MessageStringGet() should be used instead.
Reporter Info Joseph Hickey, Vantage Systems, Inc.