From: sungmin ha Date: Tue, 16 Dec 2014 06:13:01 +0000 (+0900) Subject: bug fix: modified size of memset in msgproc_cmd function X-Git-Tag: submit/tizen/20150527.025434^2~10^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d3dd452cf108292291b5037b15c0944b22c49bf8;p=platform%2Fadaptation%2Femulator%2Femulator-daemon.git bug fix: modified size of memset in msgproc_cmd function Change-Id: I66a11bb56736e8432dbdcc97aa1bc75cad1c651d Signed-off-by: sungmin ha --- diff --git a/src/common_dev.cpp b/src/common_dev.cpp index b846d93..e9ecbf3 100644 --- a/src/common_dev.cpp +++ b/src/common_dev.cpp @@ -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);