I had written one coap client with libcoap to communicate with leshan server The issue is whenever I did a PUT request, first time it is correct, but if I do a PUT request from leshan, say 12345678 is the payload it adds a garbled value after that. Also if my next payload is longer, it behaves correctly and no garbled value is padded. if I again reduce payload size, the older size retains and garbled value padded to payload. code snippet of coap client:
unsigned char *data;
memset (data, '\0', sizeof(data));
coap_get_data(request, &size, &data);
coap_get_data
getting data from server
I entered payload in leshan server as sdsdsdsdasasasast
But the client received : sdsdsdsdasasasast�
And wireshark says : sdsdsdsdasasasast\201\005
I always did a memset before inserting data into arrays, still I don't know where it got such things padded after payload