Hello community, here is the log from the commit of package corosync for openSUSE:Factory checked in at 2017-11-10 14:43:01 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/corosync (Old) and /work/SRC/openSUSE:Factory/.corosync.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "corosync" Fri Nov 10 14:43:01 2017 rev:46 rq:540403 version:2.4.3 Changes: -------- --- /work/SRC/openSUSE:Factory/corosync/corosync.changes 2017-10-25 17:44:36.275628688 +0200 +++ /work/SRC/openSUSE:Factory/.corosync.new/corosync.changes 2017-11-10 14:43:03.083203378 +0100 @@ -1,0 +2,13 @@ +Thu Nov 9 03:06:36 UTC 2017 - b...@suse.com + +- gcc: snprintf gives warning: ā%sā directive output may be truncated writing + 8 bytes into a region of size between 1 and 255(bsc#1066090) + Added: 0006-Fix-compile-warnings-with-GCC-7.2.1.patch + +------------------------------------------------------------------- +Mon Nov 6 09:14:55 UTC 2017 - b...@suse.com + +- coroparse: uidgid with empty uid or gid results into add uid 0(bsc#1066585) + Added: 0005-do-not-convert-empty-uid-gid-to-0.patch + +------------------------------------------------------------------- New: ---- 0005-do-not-convert-empty-uid-gid-to-0.patch 0006-Fix-compile-warnings-with-GCC-7.2.1.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ corosync.spec ++++++ --- /var/tmp/diff_new_pack.tzTChi/_old 2017-11-10 14:43:04.511151759 +0100 +++ /var/tmp/diff_new_pack.tzTChi/_new 2017-11-10 14:43:04.515151614 +0100 @@ -61,6 +61,8 @@ Patch9: 0002-fix-ifdown-udp.patch Patch10: 0003-fix-tmpfiles-create.patch Patch11: 0004-mark-corosync-as-a-static-service.patch +Patch12: 0005-do-not-convert-empty-uid-gid-to-0.patch +Patch13: 0006-Fix-compile-warnings-with-GCC-7.2.1.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build # openais is indeed gone and should be uninstalled. Yes, we do not @@ -137,6 +139,8 @@ %patch9 -p1 %patch10 -p1 %patch11 -p1 +%patch12 -p1 +%patch13 -p1 %build %if %{with runautogen} ++++++ 0005-do-not-convert-empty-uid-gid-to-0.patch ++++++ >From 34e3accfcbf1d5dd08468f0e7a8aa6ceb0a7828e Mon Sep 17 00:00:00 2001 From: Bin Liu <b...@suse.com> Date: Mon, 6 Nov 2017 16:59:30 +0800 Subject: [PATCH] do not convert empty uid, gid to 0 --- exec/coroparse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exec/coroparse.c b/exec/coroparse.c index 374ed7dd..f27ead1a 100644 --- a/exec/coroparse.c +++ b/exec/coroparse.c @@ -140,7 +140,7 @@ static int uid_determine (const char *req_user) char *ep; id = strtol(req_user, &ep, 10); - if (*ep == '\0' && id >= 0 && id <= UINT_MAX) { + if (*req_user != '\0' && *ep == '\0' && id >= 0 && id <= UINT_MAX) { return (id); } @@ -194,7 +194,7 @@ static int gid_determine (const char *req_group) char *ep; id = strtol(req_group, &ep, 10); - if (*ep == '\0' && id >= 0 && id <= UINT_MAX) { + if (*req_group != '\0' && *ep == '\0' && id >= 0 && id <= UINT_MAX) { return (id); } -- 2.13.6 ++++++ 0006-Fix-compile-warnings-with-GCC-7.2.1.patch ++++++ 1. sam: Fix snprintf compiler warnings 2. cpg_test_agent: Fix snprintf compiler warnings 3. quorumtool: Use full buffer size in snprintf 4. readdir_r is deprecated in glibc 2.24 in favor of readdir --- cts/agents/cpg_test_agent.c | 8 ++++---- exec/coroparse.c | 18 +++--------------- lib/sam.c | 36 ++++++++++++++++++++++++++++-------- tools/corosync-quorumtool.c | 2 +- 4 files changed, 36 insertions(+), 28 deletions(-) diff --git a/cts/agents/cpg_test_agent.c b/cts/agents/cpg_test_agent.c index 0837c69c..2224141c 100644 --- a/cts/agents/cpg_test_agent.c +++ b/cts/agents/cpg_test_agent.c @@ -211,8 +211,8 @@ static void config_change_callback ( if (record_config_events_g > 0) { log_pt = malloc (sizeof(log_entry_t)); list_init (&log_pt->list); - snprintf (log_pt->log, LOG_STR_SIZE, "%s,%u,%u,left", - groupName->value, left_list[i].nodeid,left_list[i].pid); + assert(snprintf (log_pt->log, LOG_STR_SIZE, "%s,%u,%u,left", + groupName->value, left_list[i].nodeid,left_list[i].pid) < LOG_STR_SIZE); list_add_tail(&log_pt->list, &config_chg_log_head); qb_log (LOG_INFO, "cpg event %s", log_pt->log); } @@ -221,8 +221,8 @@ static void config_change_callback ( if (record_config_events_g > 0) { log_pt = malloc (sizeof(log_entry_t)); list_init (&log_pt->list); - snprintf (log_pt->log, LOG_STR_SIZE, "%s,%u,%u,join", - groupName->value, joined_list[i].nodeid,joined_list[i].pid); + assert(snprintf (log_pt->log, LOG_STR_SIZE, "%s,%u,%u,join", + groupName->value, joined_list[i].nodeid,joined_list[i].pid) < LOG_STR_SIZE); list_add_tail (&log_pt->list, &config_chg_log_head); qb_log (LOG_INFO, "cpg event %s", log_pt->log); } diff --git a/exec/coroparse.c b/exec/coroparse.c index 2777a632..96bb83a5 100644 --- a/exec/coroparse.c +++ b/exec/coroparse.c @@ -1241,11 +1241,8 @@ static int read_uidgid_files_into_icmap( const char *dirname; DIR *dp; struct dirent *dirent; - struct dirent *entry; char filename[PATH_MAX + FILENAME_MAX + 1]; int res = 0; - size_t len; - int return_code; struct stat stat_buf; enum main_cp_cb_data_state state = MAIN_CP_CB_DATA_STATE_NORMAL; char key_name[ICMAP_KEYNAME_MAXLEN]; @@ -1256,17 +1253,9 @@ static int read_uidgid_files_into_icmap( if (dp == NULL) return 0; - len = offsetof(struct dirent, d_name) + FILENAME_MAX + 1; - - entry = malloc(len); - if (entry == NULL) { - res = 0; - goto error_exit; - } - - for (return_code = readdir_r(dp, entry, &dirent); - dirent != NULL && return_code == 0; - return_code = readdir_r(dp, entry, &dirent)) { + for (dirent = readdir(dp); + dirent != NULL; + dirent = readdir(dp)) { snprintf(filename, sizeof (filename), "%s/%s", dirname, dirent->d_name); res = stat (filename, &stat_buf); @@ -1288,7 +1277,6 @@ static int read_uidgid_files_into_icmap( } error_exit: - free (entry); closedir(dp); return res; diff --git a/lib/sam.c b/lib/sam.c index 33aa3944..527b99cb 100644 --- a/lib/sam.c +++ b/lib/sam.c @@ -145,6 +145,7 @@ static cs_error_t sam_cmap_update_key (enum sam_cmap_key_t key, const char *valu cs_error_t err; const char *svalue; uint64_t hc_period, last_hc; + const char *ssvalue[] = { [SAM_RECOVERY_POLICY_QUIT] = "quit", [SAM_RECOVERY_POLICY_RESTART] = "restart" }; char key_name[CMAP_KEYNAME_MAXLEN]; @@ -152,8 +153,13 @@ static cs_error_t sam_cmap_update_key (enum sam_cmap_key_t key, const char *valu case SAM_CMAP_KEY_RECOVERY: svalue = ssvalue[SAM_RP_MASK (sam_internal_data.recovery_policy)]; - snprintf(key_name, CMAP_KEYNAME_MAXLEN, "%s%s", sam_internal_data.cmap_pid_path, - "recovery"); + if (snprintf(key_name, CMAP_KEYNAME_MAXLEN, "%s%s", sam_internal_data.cmap_pid_path, + "recovery") >= CMAP_KEYNAME_MAXLEN) { + + err = CS_ERR_NAME_TOO_LONG; + goto exit_error; + } + if ((err = cmap_set_string(sam_internal_data.cmap_handle, key_name, svalue)) != CS_OK) { goto exit_error; } @@ -161,8 +167,13 @@ static cs_error_t sam_cmap_update_key (enum sam_cmap_key_t key, const char *valu case SAM_CMAP_KEY_HC_PERIOD: hc_period = sam_internal_data.time_interval; - snprintf(key_name, CMAP_KEYNAME_MAXLEN, "%s%s", sam_internal_data.cmap_pid_path, - "poll_period"); + if (snprintf(key_name, CMAP_KEYNAME_MAXLEN, "%s%s", sam_internal_data.cmap_pid_path, + "poll_period") >= CMAP_KEYNAME_MAXLEN) { + + err = CS_ERR_NAME_TOO_LONG; + goto exit_error; + } + if ((err = cmap_set_uint64(sam_internal_data.cmap_handle, key_name, hc_period)) != CS_OK) { goto exit_error; } @@ -170,16 +181,25 @@ static cs_error_t sam_cmap_update_key (enum sam_cmap_key_t key, const char *valu case SAM_CMAP_KEY_LAST_HC: last_hc = cs_timestamp_get(); - snprintf(key_name, CMAP_KEYNAME_MAXLEN, "%s%s", sam_internal_data.cmap_pid_path, - "last_updated"); + if (snprintf(key_name, CMAP_KEYNAME_MAXLEN, "%s%s", sam_internal_data.cmap_pid_path, + "last_updated") >= CMAP_KEYNAME_MAXLEN) { + + err = CS_ERR_NAME_TOO_LONG; + goto exit_error; + } if ((err = cmap_set_uint64(sam_internal_data.cmap_handle, key_name, last_hc)) != CS_OK) { goto exit_error; } break; case SAM_CMAP_KEY_STATE: svalue = value; - snprintf(key_name, CMAP_KEYNAME_MAXLEN, "%s%s", sam_internal_data.cmap_pid_path, - "state"); + if (snprintf(key_name, CMAP_KEYNAME_MAXLEN, "%s%s", sam_internal_data.cmap_pid_path, + "state") >= CMAP_KEYNAME_MAXLEN) { + + err = CS_ERR_NAME_TOO_LONG; + goto exit_error; + } + if ((err = cmap_set_string(sam_internal_data.cmap_handle, key_name, svalue)) != CS_OK) { goto exit_error; } diff --git a/tools/corosync-quorumtool.c b/tools/corosync-quorumtool.c index 52c141ce..19696659 100644 --- a/tools/corosync-quorumtool.c +++ b/tools/corosync-quorumtool.c @@ -519,7 +519,7 @@ static void display_nodes_data(nodeid_format_t nodeid_format, name_format_t name if (info[i].flags & VOTEQUORUM_INFO_QDEVICE_REGISTERED) { char buf[10]; - snprintf(buf, sizeof(buf) - 1, + snprintf(buf, sizeof(buf), "%s,%s,%s", info[i].flags & VOTEQUORUM_INFO_QDEVICE_ALIVE?"A":"NA", info[i].flags & VOTEQUORUM_INFO_QDEVICE_CAST_VOTE?"V":"NV", -- 2.13.6