Addressed warnings that occurred when security was enabled.
authorOssama Othman <ossama.othman@intel.com>
Mon, 22 Jun 2015 16:50:30 +0000 (09:50 -0700)
committerSachin Agrawal <sachin.agrawal@intel.com>
Mon, 22 Jun 2015 19:11:29 +0000 (19:11 +0000)
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 <ossama.othman@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1384
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Sachin Agrawal <sachin.agrawal@intel.com>
resource/csdk/connectivity/src/adapter_util/caadapternetdtls.c

index 8d58aca..f49e3d5 100644 (file)
@@ -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))