drivers/at: at_readline_stop_at_str fix remaining buffer length#21195
Merged
fabian18 merged 1 commit intoRIOT-OS:masterfrom Feb 7, 2025
Merged
drivers/at: at_readline_stop_at_str fix remaining buffer length#21195fabian18 merged 1 commit intoRIOT-OS:masterfrom
fabian18 merged 1 commit intoRIOT-OS:masterfrom
Conversation
Contributor
|
Is the keep_eol case missing a eol not replaced by -- |
kfessel
approved these changes
Feb 6, 2025
Contributor
kfessel
left a comment
There was a problem hiding this comment.
if (len == 1) is ok since 0 will never be reached due to while stopping at 1 ( last loop 2)
this last byte already is a \0 due to memset
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.
Contribution description
Fixes a tiny bug in the
atdriver that causes a return of-ENOBUFSalthough the received response fits in the buffer.It happens when the end-of-line sequence is at the last position before
\0.RIOT/drivers/at/at.c
Lines 518 to 528 in c20ce69
When the
whileloop is exited because '\n' was received at the last position before the last\0, thelenvariable was already decremented. So the-ENOBUFScondition triggers.RIOT/drivers/at/at.c
Lines 538 to 540 in c20ce69
Testing procedure
Configure a URC and send a sequence over the UART via
pytermto the microcontroller.For example "012345678901234567890123456789\n\0" for
rp_buf_size= 32.Issues/PRs references