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 error when message contains NUL bytes #5

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

sbilharz
Copy link

@sbilharz sbilharz commented Feb 21, 2020

strlen stops at the first NUL byte which breaks getting a proper grid
when the message contains any of them. The message length is known at
this point and can be passed to iec16022init instead of the message
pointer.

Edit: I now also removed the workaround that appended a blank to every input string. The strcat method also can't handle NUL bytes and I couldn't find a use case where this sort of fiddling was necessary in the first place.

strlen stops at the first NUL byte which breaks getting a proper grid
when the message contains any of them. The message length is known at
this point and can be passed to iec16022init instead of the message
pointer.
It seems odd to believe the underlying library has a bug requires us to
always append a blank at the end of the input. There might be some edge
cases where this is necessary but I did not encounter any so far.
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.

1 participant