gcoap: fix underflow when correcting ETag from cache#19968
gcoap: fix underflow when correcting ETag from cache#19968bors[bot] merged 1 commit intoRIOT-OS:masterfrom
Conversation
chrysn
left a comment
There was a problem hiding this comment.
I find it weird that we allow responses with invalid ETag values into our caches in the first place, or that opt_get_opaque can even return values outside the buffer, but that'd probably be out of scope for the bug fix here.
Looks good to me.
Note for other reviewers: The example given in the report is not showing errant behavior, it merely demonstrates that things work fine before and after when given valid inputs.
| DEBUG("gcoap: invalid calculated padding length (%lu) for ETag injection " | ||
| "during cache lookup.\n", (long unsigned)rem_len); | ||
| /* something fishy happened in the request. Better don't return cache entry */ | ||
| *cache_hit = false; |
There was a problem hiding this comment.
That's already false from an earlier check, but it doesn't hurt to be explicit either (the compiler will remove it anyway).
|
bors merge |
19968: gcoap: fix underflow when correcting ETag from cache r=chrysn a=miri64 Co-authored-by: Martine Lenders <[email protected]>
|
Build failed:
|
Seems completely unrelated. :-( |
|
bors merge |
19968: gcoap: fix underflow when correcting ETag from cache r=miri64 a=miri64 Co-authored-by: Martine Lenders <[email protected]>
|
Build failed: |
|
bors merge |
|
Build succeeded! The publicly hosted instance of bors-ng is deprecated and will go away soon. If you want to self-host your own instance, instructions are here. If you want to switch to GitHub's built-in merge queue, visit their help page. |
19987: gcoap: fix underflow when correcting ETag from cache [backport 2023.10] r=miri64 a=MrKevinWeiss # Backport of #19968 Co-authored-by: Martine Lenders <[email protected]>
19984: dist/testbed-support: Add openmote board [backport 2023.10] r=MrKevinWeiss a=miri64 # Backport of #19979 ### Contribution description As part of fixing the automated release specs test we will need support for another `cc2538` based board. I was able to get the tests passing with adaption here and to the release specs. ### Testing procedure ### Issues/PRs references 19987: gcoap: fix underflow when correcting ETag from cache [backport 2023.10] r=miri64 a=MrKevinWeiss # Backport of #19968 Co-authored-by: MrKevinWeiss <[email protected]> Co-authored-by: Martine Lenders <[email protected]>
Contribution description
Fixes an underflow error when getting a new ETag from cache, by returning early.
Testing procedure
I repeated the testing procedures from #17801 (comment) (attention, the expected input for
examples/gcoapchanged slightly in the last year and a half))
Sniffing on
tapbr0should show something like.Issues/PRs references
Reported off-band.