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

Fixed off-by-one error #3

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

Conversation

krisztianloki
Copy link
Contributor

With L==40, the terminating null byte was written after the end of VAL right into OVAL (continuously triggering a monitor). The proposed fix is more general than a simple "- 1":

Always zero out the whole 40 byte buffer of stringin and transmit only
39 bytes if requested length is 40. This way we make sure that the
resulting string is always null terminated even if the PLC sends a
non-terminated one. It also means that the effective maximum string
length is 39.

Always zero out the whole 40 byte buffer of stringin and transmit only
39 bytes if requested length is 40. This way we make sure that the
resulting string is always null terminated even if the PLC sends a
non-terminated one. It also means that the effective maximum string
length is 39.
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