-
Notifications
You must be signed in to change notification settings - Fork 2k
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
sys/net/gcoap: reduce insanity of hack #20945
Open
maribu
wants to merge
1
commit into
RIOT-OS:master
Choose a base branch
from
maribu:sys/net/gcoap/replace-super-insane-hack-with-less-insane-hack
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
sys/net/gcoap: reduce insanity of hack #20945
maribu
wants to merge
1
commit into
RIOT-OS:master
from
maribu:sys/net/gcoap/replace-super-insane-hack-with-less-insane-hack
+67
−24
Conversation
This file contains 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
maribu
added
the
CI: ready for build
If set, CI server will compile all applications for all available boards for the labeled PR
label
Nov 1, 2024
github-actions
bot
added
Area: network
Area: Networking
Area: CoAP
Area: Constrained Application Protocol implementations
Area: sys
Area: System
labels
Nov 1, 2024
maribu
commented
Nov 1, 2024
kaspar030
reviewed
Nov 1, 2024
benpicco
reviewed
Nov 1, 2024
benpicco
reviewed
Nov 1, 2024
fabian18
reviewed
Nov 1, 2024
gcoap contains a hack where a `coap_pkt_t` is pulled out of thin air, parts of the members are left uninitialized and a function is called on that mostly uninitialized data while crossing fingers hard that the result will be correct. (With the current implementation of the used function this hack does actually work.) Estimated level of insanity: 😱😱😱😱😱 This adds to insane functions to get the length of a token and the length of a header of a CoAP packet while crossing fingers hard that the packet is valid and that the functions do not overread. Estimated level of insanity: 😱😱😱 The newly introduced insane functions are used to replace the old insane hack, resulting in an estimated reduction of insanity of 😱😱. Side note: This actually does fix a bug, as the old code did not take into account the length of the extended TKL field in case of RFC 8974 being used. But that is a bug in the abused API, and not in the caller abusing the API.
maribu
force-pushed
the
sys/net/gcoap/replace-super-insane-hack-with-less-insane-hack
branch
from
November 1, 2024 15:33
aa77667
to
765dc3a
Compare
I squashed, as |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Area: CoAP
Area: Constrained Application Protocol implementations
Area: network
Area: Networking
Area: sys
Area: System
CI: ready for build
If set, CI server will compile all applications for all available boards for the labeled PR
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
gcoap contains a hack where a
coap_pkt_t
is pulled out of thin air, parts of the members are left uninitialized and a function is called on that mostly uninitialized data while crossing fingers hard that the result will be correct. (With the current implementation of the used function this hack does actually work.)Estimated level of insanity: 😱😱😱😱😱
This adds to insane functions to get the length of a token and the length of a header of a CoAP packet while crossing fingers hard that the packet is valid and that the functions do not overread.
Estimated level of insanity: 😱😱😱
The newly introduced insane functions are used to replace the old insane hack, resulting in an estimated reduction of insanity of 😱😱.
Note
This actually does fix a bug, as the old code did not take into account the length of the extended TKL field in case of RFC 8974 being used. But that is a bug in the abused API, and not in the caller abusing the API.
Testing procedure
gcoap unit tests should still pass.
Issues/PRs references
None