corosync/0008-wd-fix-snprintf-warnings.patch
Bin Liu 868d6de717 Accepting request 571270 from home:BinLiu:branches:network:ha-clustering:Factory
- corosync exposes itself for a self-crash under rare circumstance(bsc#1078412)
    Added: 0013-logging-Make-blackbox-configurable.patch
           0014-logging-Close-before-and-open-blackbox-after-fork.patch
    Modified: remove unncessary git commit messages
           0001-coroapi-Use-size_t-for-private_data_size.patch
           0002-fix-ifdown-udp.patch
           0005-do-not-convert-empty-uid-gid-to-0.patch
           0008-wd-fix-snprintf-warnings.patch
           0010-qdevice-mv-free-str-after-port-validation.patch
           0011-libcpg-Fix-issue-with-partial-big-packet-assembly.patch
           0012-totemudp-u-Drop-truncated-packets-on-receive.patch

OBS-URL: https://build.opensuse.org/request/show/571270
OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/corosync?expand=0&rev=133
2018-01-31 06:32:47 +00:00

61 lines
2.6 KiB
Diff

diff --git a/exec/wd.c b/exec/wd.c
index 8d0734c9..042d2046 100644
--- a/exec/wd.c
+++ b/exec/wd.c
@@ -221,15 +221,15 @@ static int32_t wd_resource_state_is_ok (struct resource *ref)
uint64_t allowed_period;
char key_name[ICMAP_KEYNAME_MAXLEN];
- snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "%s%s", ref->res_path, "last_updated");
- if (icmap_get_uint64(key_name, &last_updated) != CS_OK) {
+ if ((snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "%s%s", ref->res_path, "last_updated") >= ICMAP_KEYNAME_MAXLEN) ||
+ (icmap_get_uint64(key_name, &last_updated) != CS_OK)) {
/* key does not exist.
*/
return CS_FALSE;
}
- snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "%s%s", ref->res_path, "state");
- if (icmap_get_string(key_name, &state) != CS_OK || strcmp(state, "disabled") == 0) {
+ if ((snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "%s%s", ref->res_path, "state") >= ICMAP_KEYNAME_MAXLEN) ||
+ (icmap_get_string(key_name, &state) != CS_OK || strcmp(state, "disabled") == 0)) {
/* key does not exist.
*/
if (state != NULL)
@@ -279,8 +279,8 @@ static void wd_config_changed (struct cs_fsm* fsm, int32_t event, void * data)
next_timeout = ref->check_timeout;
- snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "%s%s", ref->res_path, "poll_period");
- if (icmap_get_uint64(ref->res_path, &tmp_value) == CS_OK) {
+ if ((snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "%s%s", ref->res_path, "poll_period") >= ICMAP_KEYNAME_MAXLEN) ||
+ (icmap_get_uint64(ref->res_path, &tmp_value) == CS_OK)) {
if (tmp_value >= WD_MIN_TIMEOUT_MS && tmp_value <= WD_MAX_TIMEOUT_MS) {
log_printf (LOGSYS_LEVEL_DEBUG,
"poll_period changing from:%"PRIu64" to %"PRIu64".",
@@ -299,8 +299,8 @@ static void wd_config_changed (struct cs_fsm* fsm, int32_t event, void * data)
}
}
- snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "%s%s", ref->res_path, "recovery");
- if (icmap_get_string(key_name, &ref->recovery) != CS_OK) {
+ if ((snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "%s%s", ref->res_path, "recovery") >= ICMAP_KEYNAME_MAXLEN) ||
+ (icmap_get_string(key_name, &ref->recovery) != CS_OK)) {
/* key does not exist.
*/
log_printf (LOGSYS_LEVEL_WARNING,
@@ -308,8 +308,8 @@ static void wd_config_changed (struct cs_fsm* fsm, int32_t event, void * data)
cs_fsm_state_set(&ref->fsm, WD_S_STOPPED, ref, wd_fsm_cb);
return;
}
- snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "%s%s", ref->res_path, "state");
- if (icmap_get_string(key_name, &state) != CS_OK) {
+ if ((snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "%s%s", ref->res_path, "state") >= ICMAP_KEYNAME_MAXLEN) ||
+ (icmap_get_string(key_name, &state) != CS_OK)) {
/* key does not exist.
*/
log_printf (LOGSYS_LEVEL_WARNING,
--
2.13.6