fix(esp_modem): Output buffer not cleared when AT command returns empty response (IDFGH-17370)#1026
Open
JellevanKraaij wants to merge 1 commit intoespressif:masterfrom
Open
fix(esp_modem): Output buffer not cleared when AT command returns empty response (IDFGH-17370)#1026JellevanKraaij wants to merge 1 commit intoespressif:masterfrom
JellevanKraaij wants to merge 1 commit intoespressif:masterfrom
Conversation
Author
|
Hi, could you let me know when the next release of esp_modem is planned? |
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.
Description
When
esp_modem_at()oresp_modem_at_raw()returns an empty response,the output buffer
p_outwas not cleared. This caused callers to readuninitialized or stale data when checking
p_outafter a successful ATcommand that returns no payload (e.g.
ATreturns justOKwith noadditional data).
This fix explicitly sets
p_out[0] = '\0'when the response is empty,ensuring callers can safely check the buffer without needing to
pre-initialize it themselves.
Testing
Tested on SIM7080G with esp-idf v5.5.3 using
esp_modem_at(dce, "AT", buf, 1000).Previously
bufcontained garbage when the command succeeded, now it iscorrectly cleared to an empty string.
Note
Low Risk
Low risk, localized change to the C API output handling; main risk is minor behavior change for callers that previously relied on stale buffer contents when responses were empty.
Overview
Fixes
esp_modem_at()andesp_modem_at_raw()to always write a valid C string top_outwhen provided.When the modem returns an empty payload, the functions now explicitly set
p_out[0] = '\0'instead of leaving the buffer unchanged, preventing callers from reading stale/garbage data after successful commands with no response body.Written by Cursor Bugbot for commit b45bee2. This will update automatically on new commits. Configure here.