Fix the bug for propagating CAEndpoint_t id to OCDevAddr id
authorShilpa Sodani <shilpa.a.sodani@intel.com>
Tue, 28 Jul 2015 17:28:20 +0000 (10:28 -0700)
committerSachin Agrawal <sachin.agrawal@intel.com>
Tue, 28 Jul 2015 23:22:32 +0000 (23:22 +0000)
Fixed CopyEndpointToDevAddr function to copy CAEndpoint_t id to OCDevAddr id
so that the endpoint id is propagated to stack.

Change-Id: I3b6f2ec502ab041ab36745231eac3818838eeb6b
Signed-off-by: Shilpa Sodani <shilpa.a.sodani@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1962
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Sachin Agrawal <sachin.agrawal@intel.com>
resource/csdk/stack/src/ocstack.c

index 54d6085..555210e 100644 (file)
@@ -419,9 +419,10 @@ void CopyEndpointToDevAddr(const CAEndpoint_t *in, OCDevAddr *out)
 
     out->adapter = (OCTransportAdapter)in->adapter;
     out->flags = CAToOCTransportFlags(in->flags);
-    strncpy(out->addr, in->addr, MAX_ADDR_STR_SIZE);
-    out->addr[MAX_ADDR_STR_SIZE - 1] = '\0';
+    OICStrcpy(out->addr, sizeof(out->addr), in->addr);
     out->port = in->port;
+    memcpy(&out->identity.id, &in->identity.id, sizeof(out->identity.id));
+    out->identity.id_length = in->identity.id_length;
 }
 
 void CopyDevAddrToEndpoint(const OCDevAddr *in, CAEndpoint_t *out)