Fix strcpy in occlientcoll
authorHabib Virji <habib.virji@samsung.com>
Mon, 26 Sep 2016 22:15:36 +0000 (23:15 +0100)
committerZiran Sun <ziran.sun@samsung.com>
Tue, 27 Sep 2016 09:31:47 +0000 (09:31 +0000)
occlientcoll was using strcpy, changed it with OICStrcpy.

https://jira.iotivity.org/browse/IOT-1310

Change-Id: I51b6c46ea3095eea60c225953c38dfbe65985e7c
Signed-off-by: Habib Virji <habib.virji@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/12237
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Ziran Sun <ziran.sun@samsung.com>
resource/csdk/stack/samples/linux/SimpleClientServer/occlientcoll.cpp

index 5e576b4..9a5103d 100644 (file)
@@ -37,6 +37,8 @@
 #include "payload_logging.h"
 #include "logger.h"
 #include "common.h"
+#include "oic_string.h"
+
 std::string getQueryStrForGetPut();
 
 #define TAG ("occlient")
@@ -359,7 +361,7 @@ int InitDiscovery()
     /* Start a discovery query*/
     char szQueryUri[MAX_QUERY_LENGTH] = { 0 };
 
-    strcpy(szQueryUri, RESOURCE_DISCOVERY_QUERY);
+    OICStrcpy(szQueryUri, sizeof(RESOURCE_DISCOVERY_QUERY), RESOURCE_DISCOVERY_QUERY);
 
     cbData.cb = discoveryReqCB;
     cbData.context = (void*)DEFAULT_CONTEXT_VALUE;