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

CF writes to received SB buffer #420

Open
2 tasks done
jphickey opened this issue Nov 30, 2023 · 0 comments
Open
2 tasks done

CF writes to received SB buffer #420

jphickey opened this issue Nov 30, 2023 · 0 comments
Assignees
Labels

Comments

@jphickey
Copy link
Contributor

Checklist (Please check before submitting)

  • I reviewed the Contributing Guide.
  • 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

CF/fsw/src/cf_cmd.c

Lines 147 to 149 in a0d35e1

/* make sure that the src and dst filenames are null terminated */
tx->src_filename[sizeof(tx->src_filename) - 1] = 0;
tx->dst_filename[sizeof(tx->dst_filename) - 1] = 0;

CF/fsw/src/cf_cmd.c

Lines 190 to 192 in a0d35e1

/* make sure that the src and dst filenames are null terminated */
tx->src_filename[sizeof(tx->src_filename) - 1] = 0;
tx->dst_filename[sizeof(tx->dst_filename) - 1] = 0;

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.

@jphickey jphickey self-assigned this Nov 30, 2023
@jphickey jphickey added the bug label Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant