dtls_debug.c: fix minor bug with zero termination.#121
Merged
obgm merged 1 commit intoeclipse-tinydtls:developfrom Feb 3, 2022
Merged
dtls_debug.c: fix minor bug with zero termination.#121obgm merged 1 commit intoeclipse-tinydtls:developfrom
obgm merged 1 commit intoeclipse-tinydtls:developfrom
Conversation
3984f7c to
65efd6c
Compare
obgm
reviewed
Jan 18, 2022
dtls_debug.c
Outdated
| default: | ||
| memcpy(buf, "(unknown address type)", min(22, len)); | ||
| return min(22, len); | ||
| // include terminating \000 |
Contributor
There was a problem hiding this comment.
Please use the /* ... */ comment syntax.
Contributor
Author
There was a problem hiding this comment.
Yes, I will do. (Sorry for that, I work on too much stuff in parallel with all different rules. Please keep on requesting to comply to your source format rules.)
7518cf8 to
fc73961
Compare
Contributor
Author
|
Now with "assert". |
Providing a too small buffer may result in missing the zero termination. This adds an assert to ensure, that the buffer is large enough. Signed-off-by: Achim Kraus <achim.kraus@bosch.io>
fc73961 to
d7b94c0
Compare
Contributor
Author
|
Now, with two locals. |
Contributor
|
Thanks for doing the changes! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Providing a too small buffer may result in missing the zero termination.
This fix prevents that, even if currently no too small buffers are
used.
Signed-off-by: Achim Kraus achim.kraus@bosch.io