dev: fix bug of none terminated string 58/70058/1
authorJinhyung Choi <jinh0.choi@samsung.com>
Wed, 18 May 2016 02:24:43 +0000 (11:24 +0900)
committerJinhyung Choi <jinh0.choi@samsung.com>
Wed, 18 May 2016 02:24:43 +0000 (11:24 +0900)
Change-Id: I17b55fdf699aa2f8c8499035dbe47afcd5b7025e
Signed-off-by: Jinhyung Choi <jinh0.choi@samsung.com>
src/mobile.cpp
src/msgproc_location.cpp

index 63d60bd6485d8f0a5da5d06ed826b4715db6aa39..a49b6bcf89a1048e0fff7ec9f3681b7faadd1c5d 100644 (file)
@@ -504,7 +504,7 @@ bool msgproc_sensor(ijcommand* ijcmd)
         memset(param, 0, sizeof(*param));
 
         param->ActionID = ijcmd->msg.action;
-        memcpy(param->type_cmd, ijcmd->cmd, ID_SIZE);
+        strncpy(param->type_cmd, ijcmd->cmd, sizeof(param->type_cmd) - 1);
 
         if (pthread_create(&tid[TID_SENSOR], NULL, getting_sensor, (void*)param) != 0)
         {
index 214f21772f4ec0aa4885ba194170fc30da61d723..cbc1c3d84cb2b7122a69f2a0dd023b637f92893a 100644 (file)
@@ -254,7 +254,7 @@ bool msgproc_location(ijcommand* ijcmd)
             return true;
 
         param->ActionID = ijcmd->msg.action;
-        memcpy(param->type_cmd, ijcmd->cmd, ID_SIZE);
+        strncpy(param->type_cmd, ijcmd->cmd, sizeof(param->type_cmd) - 1);
 
         if (pthread_create(&tid[TID_LOCATION], NULL, getting_location, (void*) param) != 0)
         {