From 8945c0a25f9876281cd165da7cda1c4084183be2 Mon Sep 17 00:00:00 2001 From: Ossama Othman Date: Mon, 22 Jun 2015 09:50:30 -0700 Subject: [PATCH] Addressed warnings that occurred when security was enabled. Use memcpy() instead of OICStrcpyPartial() to copy remote endpoint identity related binary data. This addresses a pointer signedness warning caused by a unsigned char* vs char* type mismatch. Change-Id: I224d51439d57a0b86ae6ccb44aff5ece427459f8 Signed-off-by: Ossama Othman Reviewed-on: https://gerrit.iotivity.org/gerrit/1384 Tested-by: jenkins-iotivity Reviewed-by: Sachin Agrawal --- resource/csdk/connectivity/src/adapter_util/caadapternetdtls.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/resource/csdk/connectivity/src/adapter_util/caadapternetdtls.c b/resource/csdk/connectivity/src/adapter_util/caadapternetdtls.c index 8d58aca..f49e3d5 100644 --- a/resource/csdk/connectivity/src/adapter_util/caadapternetdtls.c +++ b/resource/csdk/connectivity/src/adapter_util/caadapternetdtls.c @@ -83,7 +83,11 @@ static CAEndpoint_t *GetPeerInfo(const CAEndpoint_t *peer) static CAResult_t CAAddIdToPeerInfoList(const char *peerAddr, uint32_t port, const unsigned char *id, uint16_t id_length) { - if(NULL == peerAddr || NULL == id || 0 == port || 0 == id_length) + if(NULL == peerAddr + || NULL == id + || 0 == port + || 0 == id_length + || CA_MAX_ENDPOINT_IDENTITY_LEN < id_length) { OIC_LOG(ERROR, NET_DTLS_TAG, "CAAddIdToPeerInfoList invalid parameters"); return CA_STATUS_INVALID_PARAM; @@ -98,7 +102,8 @@ static CAResult_t CAAddIdToPeerInfoList(const char *peerAddr, uint32_t port, OICStrcpy(peer->addr, sizeof(peer->addr), peerAddr); peer->port = port; - OICStrcpyPartial(peer->identity.id, sizeof(peer->identity.id), id, id_length); + + memcpy(peer->identity.id, id, id_length); peer->identity.id_length = id_length; if(NULL != GetPeerInfo(peer)) -- 2.7.4