diff options
4 files changed, 250 insertions, 1 deletions
diff --git a/meta-networking/recipes-daemons/opensaf/opensaf/0001-Catch-std-ifstream-failure-by-reference.patch b/meta-networking/recipes-daemons/opensaf/opensaf/0001-Catch-std-ifstream-failure-by-reference.patch new file mode 100644 index 000000000..8f8dba054 --- /dev/null +++ b/meta-networking/recipes-daemons/opensaf/opensaf/0001-Catch-std-ifstream-failure-by-reference.patch | |||
@@ -0,0 +1,69 @@ | |||
1 | From 77d50b8d92ef1903cbc50d8f39e05fc828696bb9 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Mon, 16 Apr 2018 14:33:35 -0700 | ||
4 | Subject: [PATCH 1/2] Catch std::ifstream::failure by reference | ||
5 | |||
6 | Fixes | ||
7 | error: catching polymorphic type 'class std::ios_base::failure' by value | ||
8 | [-Werror=catch-value=] | ||
9 | } catch (std::ofstream::failure) { | ||
10 | ^~~~~~~ | ||
11 | |||
12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
13 | --- | ||
14 | src/base/conf.cc | 4 ++-- | ||
15 | src/dtm/dtmnd/dtm_main.cc | 2 +- | ||
16 | src/dtm/dtmnd/multicast.cc | 2 +- | ||
17 | 3 files changed, 4 insertions(+), 4 deletions(-) | ||
18 | |||
19 | diff --git a/src/base/conf.cc b/src/base/conf.cc | ||
20 | index d5755a1..4820357 100644 | ||
21 | --- a/src/base/conf.cc | ||
22 | +++ b/src/base/conf.cc | ||
23 | @@ -189,7 +189,7 @@ std::string Conf::ReadFile(const std::string& path_name, | ||
24 | try { | ||
25 | str.open(path_name); | ||
26 | str >> contents; | ||
27 | - } catch (std::ifstream::failure) { | ||
28 | + } catch (std::ifstream::failure& e) { | ||
29 | contents.clear(); | ||
30 | } | ||
31 | return (str.fail() || contents.empty()) ? default_contents : contents; | ||
32 | @@ -203,7 +203,7 @@ void Conf::WriteFileAtomically(const std::string& path_name, | ||
33 | try { | ||
34 | str.open(tmp_file, std::ofstream::out | std::ofstream::trunc); | ||
35 | str << contents << std::endl; | ||
36 | - } catch (std::ofstream::failure) { | ||
37 | + } catch (std::ofstream::failure& e) { | ||
38 | success = false; | ||
39 | } | ||
40 | str.close(); | ||
41 | diff --git a/src/dtm/dtmnd/dtm_main.cc b/src/dtm/dtmnd/dtm_main.cc | ||
42 | index 3260a81..a55afac 100644 | ||
43 | --- a/src/dtm/dtmnd/dtm_main.cc | ||
44 | +++ b/src/dtm/dtmnd/dtm_main.cc | ||
45 | @@ -359,7 +359,7 @@ void UpdateNodeIdFile(DTM_INTERNODE_CB *cb) { | ||
46 | try { | ||
47 | str.open(PKGLOCALSTATEDIR "/node_id", std::ofstream::out); | ||
48 | str << std::hex << node_id << std::endl; | ||
49 | - } catch (std::ofstream::failure) { | ||
50 | + } catch (std::ofstream::failure& e) { | ||
51 | } | ||
52 | str.close(); | ||
53 | } | ||
54 | diff --git a/src/dtm/dtmnd/multicast.cc b/src/dtm/dtmnd/multicast.cc | ||
55 | index bf67b9c..7232066 100644 | ||
56 | --- a/src/dtm/dtmnd/multicast.cc | ||
57 | +++ b/src/dtm/dtmnd/multicast.cc | ||
58 | @@ -198,7 +198,7 @@ bool Multicast::GetPeersFromFile(const std::string &path_name) { | ||
59 | } | ||
60 | } | ||
61 | } | ||
62 | - } catch (std::ifstream::failure) { | ||
63 | + } catch (std::ifstream::failure& e) { | ||
64 | LOG_ER("Caught std::ifstream::failure when reading file '%s', peers=%zu", | ||
65 | path_name.c_str(), static_cast<size_t>(peers_.size())); | ||
66 | peers_.clear(); | ||
67 | -- | ||
68 | 2.17.0 | ||
69 | |||
diff --git a/meta-networking/recipes-daemons/opensaf/opensaf/0001-Fix-string-overflow-in-snprintf.patch b/meta-networking/recipes-daemons/opensaf/opensaf/0001-Fix-string-overflow-in-snprintf.patch new file mode 100644 index 000000000..428e46228 --- /dev/null +++ b/meta-networking/recipes-daemons/opensaf/opensaf/0001-Fix-string-overflow-in-snprintf.patch | |||
@@ -0,0 +1,75 @@ | |||
1 | From 8cf323a2d8e02ca0bd36deb38e613c6edac546ad Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Mon, 16 Apr 2018 18:29:17 -0700 | ||
4 | Subject: [PATCH] Fix string overflow in snprintf | ||
5 | |||
6 | Fixes errors like | ||
7 | error: '%s' dir | ||
8 | ective output may be truncated writing up to 255 bytes into a region of size 32 [-Werror=forma | ||
9 | t-truncation=] | ||
10 | snprintf(reinterpret_cast<char *>(Healthy.key), sizeof(Healthy.key), "%s", | ||
11 | ^~~~ | ||
12 | hlth_str); | ||
13 | ~~~~~~~~ | ||
14 | |||
15 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
16 | --- | ||
17 | src/log/logd/lgs_util.cc | 4 ++-- | ||
18 | src/rde/rded/rde_amf.cc | 2 +- | ||
19 | src/smf/smfd/SmfUpgradeCampaign.cc | 4 ++-- | ||
20 | 3 files changed, 5 insertions(+), 5 deletions(-) | ||
21 | |||
22 | diff --git a/src/log/logd/lgs_util.cc b/src/log/logd/lgs_util.cc | ||
23 | index ac93d5a..cce80f3 100644 | ||
24 | --- a/src/log/logd/lgs_util.cc | ||
25 | +++ b/src/log/logd/lgs_util.cc | ||
26 | @@ -200,12 +200,12 @@ char *lgs_get_time(time_t *time_in) { | ||
27 | |||
28 | stringSize = 5 * sizeof(char); | ||
29 | snprintf(srcString, (size_t)stringSize, "%d", | ||
30 | - (timeStampData->tm_year + START_YEAR)); | ||
31 | + (timeStampData->tm_year + START_YEAR) & 0x4dU); | ||
32 | |||
33 | strncpy(timeStampString, srcString, stringSize); | ||
34 | |||
35 | stringSize = 3 * sizeof(char); | ||
36 | - snprintf(srcString, (size_t)stringSize, "%02d", (timeStampData->tm_mon + 1)); | ||
37 | + snprintf(srcString, (size_t)stringSize, "%02d", (timeStampData->tm_mon + 1) & 0x2dU); | ||
38 | |||
39 | strncat(timeStampString, srcString, stringSize); | ||
40 | |||
41 | diff --git a/src/rde/rded/rde_amf.cc b/src/rde/rded/rde_amf.cc | ||
42 | index 81e521e..d53cc48 100644 | ||
43 | --- a/src/rde/rded/rde_amf.cc | ||
44 | +++ b/src/rde/rded/rde_amf.cc | ||
45 | @@ -102,7 +102,7 @@ static uint32_t rde_amf_healthcheck_start(RDE_AMF_CB *rde_amf_cb) { | ||
46 | SaAmfHealthcheckKeyT Healthy; | ||
47 | SaNameT SaCompName; | ||
48 | char *phlth_ptr; | ||
49 | - char hlth_str[256]; | ||
50 | + char hlth_str[32]; | ||
51 | |||
52 | TRACE_ENTER(); | ||
53 | |||
54 | diff --git a/src/smf/smfd/SmfUpgradeCampaign.cc b/src/smf/smfd/SmfUpgradeCampaign.cc | ||
55 | index 45cdce8..6761bcf 100644 | ||
56 | --- a/src/smf/smfd/SmfUpgradeCampaign.cc | ||
57 | +++ b/src/smf/smfd/SmfUpgradeCampaign.cc | ||
58 | @@ -447,7 +447,7 @@ SaAisErrorT SmfUpgradeCampaign::tooManyRestarts(bool *o_result) { | ||
59 | TRACE_ENTER(); | ||
60 | SaAisErrorT rc = SA_AIS_OK; | ||
61 | SaImmAttrValuesT_2 **attributes; | ||
62 | - int curCnt = 0; | ||
63 | + short int curCnt = 0; | ||
64 | |||
65 | /* Read the SmfCampRestartInfo object smfCampRestartCnt attr */ | ||
66 | std::string obj = "smfRestartInfo=info," + | ||
67 | @@ -473,7 +473,7 @@ SaAisErrorT SmfUpgradeCampaign::tooManyRestarts(bool *o_result) { | ||
68 | attrsmfCampRestartCnt.setName("smfCampRestartCnt"); | ||
69 | attrsmfCampRestartCnt.setType("SA_IMM_ATTR_SAUINT32T"); | ||
70 | char buf[5]; | ||
71 | - snprintf(buf, 4, "%d", curCnt); | ||
72 | + snprintf(buf, 4, "%hd", curCnt); | ||
73 | attrsmfCampRestartCnt.addValue(buf); | ||
74 | imoCampRestartInfo.addValue(attrsmfCampRestartCnt); | ||
75 | |||
diff --git a/meta-networking/recipes-daemons/opensaf/opensaf/0002-Fix-format-truncation-errors.patch b/meta-networking/recipes-daemons/opensaf/opensaf/0002-Fix-format-truncation-errors.patch new file mode 100644 index 000000000..9865a5e1b --- /dev/null +++ b/meta-networking/recipes-daemons/opensaf/opensaf/0002-Fix-format-truncation-errors.patch | |||
@@ -0,0 +1,102 @@ | |||
1 | From 4d58d26cbd3622183afc2e8f85c9c81edaf135df Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Mon, 16 Apr 2018 14:56:47 -0700 | ||
4 | Subject: [PATCH 2/2] Fix format-truncation errors | ||
5 | |||
6 | Fixes errors with gcc8 eg. | ||
7 | error: '%u' directive output may be truncated writing between 1 and 10 bytes into a region of size between 0 and 254 [-Werror=format-truncation=] | ||
8 | |||
9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
10 | --- | ||
11 | src/base/daemon.c | 4 ++-- | ||
12 | src/mds/mds_c_db.c | 8 ++++---- | ||
13 | src/mds/mds_core.h | 4 ++-- | ||
14 | src/mds/mds_dt2c.h | 2 +- | ||
15 | 4 files changed, 9 insertions(+), 9 deletions(-) | ||
16 | |||
17 | diff --git a/src/base/daemon.c b/src/base/daemon.c | ||
18 | index 27170d7..da97700 100644 | ||
19 | --- a/src/base/daemon.c | ||
20 | +++ b/src/base/daemon.c | ||
21 | @@ -92,11 +92,11 @@ static int __create_pidfile(const char *pidfile) | ||
22 | { | ||
23 | FILE *file = NULL; | ||
24 | int fd, rc = 0; | ||
25 | - char pidfiletmp[NAME_MAX] = {0}; | ||
26 | + char pidfiletmp[NAME_MAX+12] = {0}; | ||
27 | pid_t pid; | ||
28 | |||
29 | pid = getpid(); | ||
30 | - snprintf(pidfiletmp, NAME_MAX, "%s.%u.tmp", pidfile, pid); | ||
31 | + snprintf(pidfiletmp, NAME_MAX+12, "%s.%u.tmp", pidfile, pid); | ||
32 | |||
33 | /* open the file and associate a stream with it */ | ||
34 | if (((fd = open(pidfiletmp, O_RDWR | O_CREAT, 0644)) == -1) || | ||
35 | diff --git a/src/mds/mds_c_db.c b/src/mds/mds_c_db.c | ||
36 | index e6b95cd..3d4a222 100644 | ||
37 | --- a/src/mds/mds_c_db.c | ||
38 | +++ b/src/mds/mds_c_db.c | ||
39 | @@ -124,10 +124,10 @@ void get_adest_details(MDS_DEST adest, char *adest_details) | ||
40 | } | ||
41 | |||
42 | if (remote == true) | ||
43 | - snprintf(adest_details, MDS_MAX_PROCESS_NAME_LEN, | ||
44 | + snprintf(adest_details, MDS_MAX_PROCESS_NAME_LEN+24, | ||
45 | "<rem_nodeid[0x%" PRIx32 "]:%s>", ncs_node_id, process_name); | ||
46 | else | ||
47 | - snprintf(adest_details, MDS_MAX_PROCESS_NAME_LEN, | ||
48 | + snprintf(adest_details, MDS_MAX_PROCESS_NAME_LEN+24, | ||
49 | "<nodeid[0x%" PRIx32 "]:%s>", ncs_node_id, process_name); | ||
50 | |||
51 | m_MDS_LOG_DBG("MDS:DB: adest_details: %s ", adest_details); | ||
52 | @@ -207,10 +207,10 @@ void get_subtn_adest_details(MDS_PWE_HDL pwe_hdl, MDS_SVC_ID svc_id, | ||
53 | } | ||
54 | |||
55 | if (remote == true) | ||
56 | - snprintf(adest_details, MDS_MAX_PROCESS_NAME_LEN, | ||
57 | + snprintf(adest_details, MDS_MAX_PROCESS_NAME_LEN+24, | ||
58 | "<rem_node[0x%" PRIx32 "]:%s>", ncs_node_id, process_name); | ||
59 | else | ||
60 | - snprintf(adest_details, MDS_MAX_PROCESS_NAME_LEN, | ||
61 | + snprintf(adest_details, MDS_MAX_PROCESS_NAME_LEN+24, | ||
62 | "<node[0x%" PRIx32 "]:%s>", ncs_node_id, process_name); | ||
63 | done: | ||
64 | m_MDS_LOG_DBG("MDS:DB: adest_details: %s ", adest_details); | ||
65 | diff --git a/src/mds/mds_core.h b/src/mds/mds_core.h | ||
66 | index 37696d4..7f5225d 100644 | ||
67 | --- a/src/mds/mds_core.h | ||
68 | +++ b/src/mds/mds_core.h | ||
69 | @@ -163,7 +163,7 @@ typedef struct mds_subscription_results_info { | ||
70 | uint32_t msg_snd_cnt; /* Message send count to this destination */ | ||
71 | uint32_t msg_rcv_cnt; /* Message rcv count from this destination */ | ||
72 | char sub_adest_details | ||
73 | - [MDS_MAX_PROCESS_NAME_LEN]; /* <node[slotno]:processname[pid]> */ | ||
74 | + [MDS_MAX_PROCESS_NAME_LEN+24]; /* <node[slotno]:processname[pid]> */ | ||
75 | |||
76 | } MDS_SUBSCRIPTION_RESULTS_INFO; | ||
77 | |||
78 | @@ -194,7 +194,7 @@ typedef struct mds_subscription_info { | ||
79 | count is grater than ZERO bcast (multi-unicast) */ | ||
80 | uint32_t prev_ver_sub_count; | ||
81 | char sub_adest_details | ||
82 | - [MDS_MAX_PROCESS_NAME_LEN]; /* <node[slotno]:processname[pid]> */ | ||
83 | + [MDS_MAX_PROCESS_NAME_LEN+24]; /* <node[slotno]:processname[pid]> */ | ||
84 | |||
85 | } MDS_SUBSCRIPTION_INFO; | ||
86 | |||
87 | diff --git a/src/mds/mds_dt2c.h b/src/mds/mds_dt2c.h | ||
88 | index 012999c..006b722 100644 | ||
89 | --- a/src/mds/mds_dt2c.h | ||
90 | +++ b/src/mds/mds_dt2c.h | ||
91 | @@ -143,7 +143,7 @@ typedef struct mdtm_send_req { | ||
92 | */ | ||
93 | MDS_DEST adest; /* MDTM to do local/remote routing, destination adest */ | ||
94 | char sub_adest_details | ||
95 | - [MDS_MAX_PROCESS_NAME_LEN]; /* <node[nodeid]:processname[pid]> */ | ||
96 | + [MDS_MAX_PROCESS_NAME_LEN+24]; /* <node[nodeid]:processname[pid]> */ | ||
97 | MDS_SEND_PRIORITY_TYPE pri; | ||
98 | MDS_CLIENT_MSG_FORMAT_VER | ||
99 | msg_fmt_ver; /* message format version specification */ | ||
100 | -- | ||
101 | 2.17.0 | ||
102 | |||
diff --git a/meta-networking/recipes-daemons/opensaf/opensaf_5.18.02.bb b/meta-networking/recipes-daemons/opensaf/opensaf_5.18.02.bb index 4b556ce8c..1a7d00ee3 100644 --- a/meta-networking/recipes-daemons/opensaf/opensaf_5.18.02.bb +++ b/meta-networking/recipes-daemons/opensaf/opensaf_5.18.02.bb | |||
@@ -24,7 +24,10 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/releases/${BPN}-${PV}.tar.gz \ | |||
24 | file://0001-configure-Disable-format-overflow-if-supported-by-gc.patch \ | 24 | file://0001-configure-Disable-format-overflow-if-supported-by-gc.patch \ |
25 | file://0001-src-Add-missing-header-limits.h-for-_POSIX_HOST_NAME.patch \ | 25 | file://0001-src-Add-missing-header-limits.h-for-_POSIX_HOST_NAME.patch \ |
26 | file://0001-immpbe_dump.cc-Use-sys-wait.h-instead-of-wait.h.patch \ | 26 | file://0001-immpbe_dump.cc-Use-sys-wait.h-instead-of-wait.h.patch \ |
27 | " | 27 | file://0001-Catch-std-ifstream-failure-by-reference.patch \ |
28 | file://0002-Fix-format-truncation-errors.patch \ | ||
29 | file://0001-Fix-string-overflow-in-snprintf.patch \ | ||
30 | " | ||
28 | SRC_URI[md5sum] = "42064f5ddbc7f560bfc5ff93ea9eecc7" | 31 | SRC_URI[md5sum] = "42064f5ddbc7f560bfc5ff93ea9eecc7" |
29 | SRC_URI[sha256sum] = "f9e24897f9cfd63bb3115f6275c706de1702d3d9bae2fc423227db72b23c37f0" | 32 | SRC_URI[sha256sum] = "f9e24897f9cfd63bb3115f6275c706de1702d3d9bae2fc423227db72b23c37f0" |
30 | 33 | ||