emuld: fix some defects 36/56436/3 accepted/tizen/ivi/20160218.022824 accepted/tizen/mobile/20160108.115904 accepted/tizen/tv/20160108.113609 accepted/tizen/wearable/20160108.113750 submit/tizen/20160108.083405 submit/tizen_common/20160218.142243 submit/tizen_ivi/20160217.000000 submit/tizen_ivi/20160217.000001
authorChulHo Song <ch81.song@samsung.com>
Fri, 8 Jan 2016 02:40:58 +0000 (11:40 +0900)
committerChulHo Song <ch81.song@samsung.com>
Fri, 8 Jan 2016 06:40:03 +0000 (15:40 +0900)
close file pointer.
change strcat to strncat

Change-Id: Ie1e7e698f6ab619a783b7570d52b0a2aa232166f
Signed-off-by: ChulHo Song <ch81.song@samsung.com>
src/common.cpp
src/net.cpp

index d19c68649c98fd07654a63c155530c7f80de6b2c..af7cfa58d2c956899bfd6d53472e67b3d8ef16fe 100644 (file)
@@ -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, "/");
         }
 
index 6723a96ff8f8a8e292a984b05fc45441f6d0eb47..aae348c70c07a023acc7e172586b496e32255712 100644 (file)
@@ -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;
     }