From 21f31f20b2f1541f15fe06cd26fce221120dda78 Mon Sep 17 00:00:00 2001 From: Kunhoon Baik Date: Thu, 27 Oct 2016 09:12:07 +0900 Subject: Ingore SIGPIPE default behavior TLM session daemon uses several communication libraries like syslog, pam, and so on. Thus, basically it should handle SIGPIPE. Otherwise, the daemon will be exited unexpectedly, it will make user-session unstable. Change-Id: Idd52ba703f3e732b6ccc6c9f1a35c18a952c0f9b --- src/sessiond/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sessiond/main.c b/src/sessiond/main.c index d0e4db6..23317d9 100755 --- a/src/sessiond/main.c +++ b/src/sessiond/main.c @@ -72,6 +72,12 @@ _install_sighandlers (GMainLoop *main_loop) WARN ("failed to ignore SIGINT: %s", strerror_r(errno, strerr_buf, MAX_STRERROR_LEN)); } + if (signal (SIGPIPE, SIG_IGN) == SIG_ERR) + { + gchar strerr_buf[MAX_STRERROR_LEN] = {0,}; + WARN ("failed to ignore SIGPIPE: %s", strerror_r(errno, strerr_buf, MAX_STRERROR_LEN)); + } + source = g_unix_signal_source_new (SIGTERM); g_source_set_callback (source, _handle_quit_signal, -- cgit v1.2.3 From 3c49607ce6f0b22bacc04fa7efa5603bb2752513 Mon Sep 17 00:00:00 2001 From: Yunmi Ha Date: Wed, 30 Nov 2016 16:37:57 +0900 Subject: Fix some security holes - 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 --- src/common/tlm-utils.c | 6 +++--- src/utils/tlm-client.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) mode change 100644 => 100755 src/utils/tlm-client.c diff --git a/src/common/tlm-utils.c b/src/common/tlm-utils.c index 22c3ea9..cc04208 100755 --- a/src/common/tlm-utils.c +++ b/src/common/tlm-utils.c @@ -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); diff --git a/src/utils/tlm-client.c b/src/utils/tlm-client.c old mode 100644 new mode 100755 index 7551f61..1d07747 --- a/src/utils/tlm-client.c +++ b/src/utils/tlm-client.c @@ -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; } -- cgit v1.2.3