Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sys/net/gcoap: reduce insanity of hack
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.
- Loading branch information