pdu.c -- minimize changes to allow for migrating github/develop branch
Only one addition by Ranjan explained as:
lwm2m: coap pdu payload function modified to terminate the string; function added in lwm2m resource file to handle single resource update;
The following two lines of code were added:
pdu->data++;
pdu->data = '\0';
resulting in:
pdu->data = (unsigned char *)pdu->hdr + pdu->length;
*pdu->data = COAP_PAYLOAD_START;
pdu->data++;
memcpy(pdu->data, data, len);
pdu->data++;
pdu->data = '\0';
pdu->length += len + 1;
This looks like a bug fix but is there really a bug? data is added. If data contained a \0-terminated string, maybe len was not large enough. strlen(str) does not include the termination null-char; so if strlen(str) is used to determine len for the memcpy here, strlen(str)+1 might be the appropriate solution when invoking the function call.
@andreea.ancuta.corici @ranjan.shrestha @ban : let's discuss the reason for this change.