From: ChulHo Song Date: Fri, 8 Jan 2016 02:40:58 +0000 (+0900) Subject: emuld: fix some defects X-Git-Tag: submit/tizen/20160108.083405^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=205a52761c74bbe623b3df7a8aac650022804d0c;p=platform%2Fadaptation%2Femulator%2Femulator-daemon.git emuld: fix some defects close file pointer. change strcat to strncat Change-Id: Ie1e7e698f6ab619a783b7570d52b0a2aa232166f Signed-off-by: ChulHo Song --- diff --git a/src/common.cpp b/src/common.cpp index d19c686..af7cfa5 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -383,7 +383,8 @@ static bool do_package(int action, char* data) strcat(pkg_list, " "); if (action == 2) { strcat(pkg_list, PATH_PACKAGE_INSTALL); - strcat(pkg_list, addon); + remain = MAX_PKGS_BUF - strnlen(pkg_list, MAX_PKGS_BUF) - strlen("/"); + strncat(pkg_list, addon, remain - 1); // terminating null byte strcat(pkg_list, "/"); } diff --git a/src/net.cpp b/src/net.cpp index 6723a96..aae348c 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -381,6 +381,7 @@ static int get_network_info(char str[], int str_size) if (!line) { LOGERR("failed to read /proc/cmdline"); + fclose(fp); return -1; }