#define CA_BUFSIZE (128)
#define CA_PDU_MIN_SIZE (4)
-#define CA_PORT_BUFFER_SIZE (2)
+#define CA_PORT_BUFFER_SIZE (4)
static const char COAP_URI_HEADER[] = "coap://[::]/";
coap_delete_list(optlist);
return NULL;
}
-
- pdu = CAGeneratePDUImpl((code_t) code, optlist, info, info.payload, strlen(info.payload));
+ size_t lenPayload = info.payload ? strlen(info.payload) : 0;
+ pdu = CAGeneratePDUImpl((code_t) code, optlist, info, info.payload, lenPayload);
if (NULL == pdu)
{
OIC_LOG(ERROR, TAG, "pdu NULL");
// Make sure there is enough room in the optionResult buffer
if ((optionLength + bufLength) < sizeof(optionResult))
{
- memcpy(optionResult + optionLength, buf, bufLength);
+ memcpy(&optionResult[optionLength], buf, bufLength);
optionLength += bufLength;
}
else
// Make sure there is enough room in the optionResult buffer
if ((optionLength + bufLength) < sizeof(optionResult))
{
- memcpy(optionResult + optionLength, buf, bufLength);
+ memcpy(&optionResult[optionLength], buf, bufLength);
optionLength += bufLength;
}
else
}
coap_hdr_t *hdr = (coap_hdr_t *) pdu;
- if (NULL == hdr)
- {
- return CA_MSG_NONCONFIRM;
- }
return (CAMessageType_t) hdr->type;
}
}
coap_hdr_t *hdr = (coap_hdr_t *) pdu;
- if (NULL == hdr)
- {
- return 0;
- }
return hdr->id;
}
}
coap_hdr_t *hdr = (coap_hdr_t *) pdu;
- if (NULL == hdr)
- {
- OIC_LOG(ERROR, TAG, "hdr is null");
- return CA_NOT_FOUND;
- }
return (CAResponseResult_t) CA_RESPONSE_CODE(hdr->code);
}