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.
The method
dessert_msg_getpayloadretrieves 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 codeIt sets the pointer to the right position (after the header), but the payload length should be transformed via ntohs.