Fix some security holes 59/101059/2 accepted/tizen/3.0/common/20161130.133917 accepted/tizen/3.0/ivi/20161130.092941 accepted/tizen/3.0/mobile/20161130.092844 accepted/tizen/3.0/tv/20161130.092901 accepted/tizen/3.0/wearable/20161130.092918 submit/tizen_3.0/20161130.085157
authorYunmi Ha <yunmi.ha@samsung.com>
Wed, 30 Nov 2016 07:37:57 +0000 (16:37 +0900)
committerYunmi Ha <yunmi.ha@samsung.com>
Wed, 30 Nov 2016 08:20:20 +0000 (17:20 +0900)
- Uninitialized data is read from local variable : Add initializing logic
- unreachable code : Add string length chekcing logic

Change-Id: I595494f01046b69b7afec6facd0cf1701e72f965
Signed-off-by: Yunmi Ha <yunmi.ha@samsung.com>
src/common/tlm-utils.c
src/utils/tlm-client.c [changed mode: 0644->0755]

index 22c3ea97825f70051e0c6746c732cfcecfe1e9d5..cc042087515d90455fcfbb647bc097e28d10f777 100755 (executable)
@@ -61,7 +61,7 @@ g_clear_string (gchar **str)
 gchar *
 tlm_user_get_name (uid_t user_id)
 {
-    struct passwd *pwent;
+    struct passwd *pwent = NULL;
     struct passwd buf_pwent;
     gchar *buf = NULL, *tmp = NULL, *pw_name = NULL;
     gsize size = sysconf(_SC_GETPW_R_SIZE_MAX);
@@ -162,7 +162,7 @@ tlm_user_get_gid (const gchar *username)
 gchar *
 tlm_user_get_home_dir (const gchar *username)
 {
-    struct passwd *pwent;
+    struct passwd *pwent = NULL;
     struct passwd buf_pwent;
     gchar *buf = NULL, *tmp = NULL, *pw_dir = NULL;
     gsize size = sysconf(_SC_GETPW_R_SIZE_MAX);
@@ -197,7 +197,7 @@ tlm_user_get_home_dir (const gchar *username)
 gchar *
 tlm_user_get_shell (const gchar *username)
 {
-    struct passwd *pwent;
+    struct passwd *pwent = NULL;
     struct passwd buf_pwent;
     gchar *buf = NULL, *tmp = NULL, *pw_shell = NULL;
     gsize size = sysconf(_SC_GETPW_R_SIZE_MAX);
old mode 100644 (file)
new mode 100755 (executable)
index 7551f61..1d07747
@@ -94,7 +94,7 @@ _setup_daemon ()
     if (env_val)
         bin_path = env_val;
 #endif
-    if(!bin_path) {
+    if(!bin_path || strlen(bin_path) == 0) {
         WARN("No TLM daemon bin path found");
         return FALSE;
     }