bug fix: modified size of memset in msgproc_cmd function
authorsungmin ha <sungmin82.ha@samsung.com>
Tue, 16 Dec 2014 06:13:01 +0000 (15:13 +0900)
committersungmin ha <sungmin82.ha@samsung.com>
Tue, 16 Dec 2014 06:14:48 +0000 (15:14 +0900)
Change-Id: I66a11bb56736e8432dbdcc97aa1bc75cad1c651d
Signed-off-by: sungmin ha <sungmin82.ha@samsung.com>
src/common_dev.cpp

index b846d9325cf428b5c5331c2f6539ef2c5f972f0d..e9ecbf37452cf464e5e7e45fc2bfc84f31ef9334 100644 (file)
@@ -417,7 +417,12 @@ void msgproc_cmd(int fd, ijcommand* ijcmd)
     pthread_t cmd_thread_id;
     char *cmd = (char*) malloc(ijcmd->msg.length + 1);
 
-    memset(cmd, 0x00, sizeof(cmd));
+    if (!cmd) {
+        LOGERR("malloc failed.");
+        return;
+    }
+
+    memset(cmd, 0x00, ijcmd->msg.length + 1);
     strncpy(cmd, ijcmd->data, ijcmd->msg.length);
     LOGDEBUG("cmd: %s, length: %d", cmd, ijcmd->msg.length);