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

payload length in dessert_msg_getpayload #5

Open
mfrey opened this issue Aug 13, 2014 · 0 comments
Open

payload length in dessert_msg_getpayload #5

mfrey opened this issue Aug 13, 2014 · 0 comments
Labels

Comments

@mfrey
Copy link
Member

mfrey commented Aug 13, 2014

The method dessert_msg_getpayload retrieves a pointer to the payload of a dessert message. It returns the length of the payload. However the payload is not transformed to host byte order. From the source code

int dessert_msg_getpayload(dessert_msg_t* msg, void** payload) {
    /* test if payload is present in msg */
    if(msg->plen == 0) {
        *payload = NULL;
        return 0;
    }

    *payload = (uint8_t*) msg + ntohs(msg->hlen);

    return msg->plen;
}

It sets the pointer to the right position (after the header), but the payload length should be transformed via ntohs.

@mfrey mfrey added the bug label Aug 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant