Skip to content
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
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Nov 1, 2024

  1. 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.
    maribu committed Nov 1, 2024
    Configuration menu
    Copy the full SHA
    765dc3a View commit details
    Browse the repository at this point in the history