unicoap message initialisers (see sys/include/net/unicoap/message.h) do not set the payload_representation property to UNICOAP_PAYLOAD_REPRESENTATION_CONTIGUOUS. The point of these initialisers is that one does not need to zero a message structure before. However, right now, the representation might be randomly set to the wrong representation, which trivially leads to a segfault.
unicoap_message_t message;
unicoap_message_init_string(...); // May end up with with wrong payload representation
unicoap_message_t message = {};
unicoap_message_init_string(...); // Works because is zeroed before.
Fix by setting message->payload_representation = UNICOAP_PAYLOAD_REPRESENTATION_CONTIGUOUS in initialisers.
unicoapmessage initialisers (seesys/include/net/unicoap/message.h) do not set thepayload_representationproperty toUNICOAP_PAYLOAD_REPRESENTATION_CONTIGUOUS. The point of these initialisers is that one does not need to zero a message structure before. However, right now, the representation might be randomly set to the wrong representation, which trivially leads to a segfault.Fix by setting
message->payload_representation = UNICOAP_PAYLOAD_REPRESENTATION_CONTIGUOUSin initialisers.