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 #137, Reduce length of string_variable[] initializer string #138

Conversation

thnkslprpt
Copy link
Contributor

Checklist

Describe the contribution
Fixes #137
Reduced the length of the initializer-string for string_variable[] so as to avoid potential overflow due to automatic addition of the terminating null character by the compiler.

Testing performed
GitHub CI actions all passing successfully.

Expected behavior changes
No impact on code behavior.

Contributor Info
Avi Weiss @thnkslprpt

Copy link
Contributor

@jphickey jphickey left a comment

Choose a reason for hiding this comment

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

Actually I don't think this one needs fixing. The C compiler allows for the string to completely fill the buffer, it just won't terminate it with a NUL char as a result. This is OK in this case because this is part of the "SendDataTypes" command and the intent here is specifically to check for corner cases in the data encodings. This intentionally has a string buffer that is 10 chars in size and it fills all 10 chars.

Any software that receives these TLM messages must decode messages properly according to the definition and should never assume that string buffers are null terminated. This test command helps check for that by intentionally sending such a message where the string is entirely full and there is no terminating char.

@thnkslprpt
Copy link
Contributor Author

Makes sense Joe - thanks for the explanation.

@thnkslprpt thnkslprpt closed this Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

string_variable[] initializer-string is too long
2 participants