corosync/0010-qdevice-mv-free-str-after-port-validation.patch
Bin Liu 2b389892e9 Accepting request 561082 from home:BinLiu:branches:network:ha-clustering:Factory
- qdevice failed to run(bsc#1074276)
    Added: 0010-qdevice-mv-free-str-after-port-validation.patch

- add support for corosync-qdevice in yast2-cluster and bootstrap(bsc#1070961)
    Added: 0009-add-config-for-corosync-qnetd.patch

OBS-URL: https://build.opensuse.org/request/show/561082
OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/corosync?expand=0&rev=128
2018-01-03 02:29:50 +00:00

41 lines
1.2 KiB
Diff

From 60d419917ac5a64abe8539bedb9fd57af1451ff5 Mon Sep 17 00:00:00 2001
From: Bin Liu <bliu@suse.com>
Date: Wed, 27 Dec 2017 18:21:34 +0800
Subject: [PATCH] qdevice: mv free(str) after port validation
in the previous code of qdevice_net_instance_init_from_cmap:
host_port = strtol(str, &ep, 10);
free(str);
if (host_port <= 0 || host_port > ((uint16_t)~0) || *ep != '\0')
before free, *ep is '\0'. But after free, *ep changed to 'U', so mv
free behind the comparison.
---
qdevices/qdevice-net-instance.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/qdevices/qdevice-net-instance.c b/qdevices/qdevice-net-instance.c
index 7adcaa3f..e4b7b04d 100644
--- a/qdevices/qdevice-net-instance.c
+++ b/qdevices/qdevice-net-instance.c
@@ -274,12 +274,12 @@ qdevice_net_instance_init_from_cmap(struct qdevice_instance *instance)
if (cmap_get_string(cmap_handle, "quorum.device.net.port", &str) == CS_OK) {
host_port = strtol(str, &ep, 10);
- free(str);
-
if (host_port <= 0 || host_port > ((uint16_t)~0) || *ep != '\0') {
qdevice_log(LOG_ERR, "quorum.device.net.port must be in range 0-65535");
+ free(str);
goto error_free_host_addr;
}
+ free(str);
} else {
host_port = QNETD_DEFAULT_HOST_PORT;
}
--
2.13.6