diff --git a/SOURCES/0003-covscan-sctp.patch b/SOURCES/0003-covscan-sctp.patch new file mode 100644 index 0000000..3d18870 --- /dev/null +++ b/SOURCES/0003-covscan-sctp.patch @@ -0,0 +1,69 @@ +diff --git a/src/iperf_sctp.c b/src/iperf_sctp.c +index a0869a3..13f5cdf 100644 +--- a/src/iperf_sctp.c ++++ b/src/iperf_sctp.c +@@ -130,12 +130,14 @@ iperf_sctp_accept(struct iperf_test * test) + + if (Nread(s, cookie, COOKIE_SIZE, Psctp) < 0) { + i_errno = IERECVCOOKIE; ++ close(s); + return -1; + } + +- if (strcmp(test->cookie, cookie) != 0) { ++ if (strncmp(test->cookie, cookie, COOKIE_SIZE) != 0) { + if (Nwrite(s, (char*) &rbuf, sizeof(rbuf), Psctp) < 0) { + i_errno = IESENDMESSAGE; ++ close(s); + return -1; + } + close(s); +@@ -209,9 +211,11 @@ iperf_sctp_listen(struct iperf_test *test) + + /* servers must call sctp_bindx() _instead_ of bind() */ + if (!TAILQ_EMPTY(&test->xbind_addrs)) { +- freeaddrinfo(res); +- if (iperf_sctp_bindx(test, s, IPERF_SCTP_SERVER)) ++ if (iperf_sctp_bindx(test, s, IPERF_SCTP_SERVER)) { ++ close(s); ++ freeaddrinfo(res); + return -1; ++ } + } else + if (bind(s, (struct sockaddr *) res->ai_addr, res->ai_addrlen) < 0) { + saved_errno = errno; +@@ -422,8 +426,11 @@ iperf_sctp_connect(struct iperf_test *test) + + /* clients must call bind() followed by sctp_bindx() before connect() */ + if (!TAILQ_EMPTY(&test->xbind_addrs)) { +- if (iperf_sctp_bindx(test, s, IPERF_SCTP_CLIENT)) ++ if (iperf_sctp_bindx(test, s, IPERF_SCTP_CLIENT)) { ++ freeaddrinfo(server_res); ++ close(s); + return -1; ++ } + } + + /* TODO support sctp_connectx() to avoid heartbeating. */ +@@ -435,12 +442,12 @@ iperf_sctp_connect(struct iperf_test *test) + i_errno = IESTREAMCONNECT; + return -1; + } +- freeaddrinfo(server_res); + + /* Send cookie for verification */ + if (Nwrite(s, test->cookie, COOKIE_SIZE, Psctp) < 0) { + saved_errno = errno; + close(s); ++ freeaddrinfo(server_res); + errno = saved_errno; + i_errno = IESENDCOOKIE; + return -1; +@@ -464,6 +471,7 @@ iperf_sctp_connect(struct iperf_test *test) + return -1; + } + ++ freeaddrinfo(server_res); + return s; + #else + i_errno = IENOSCTP; diff --git a/SPECS/iperf3.spec b/SPECS/iperf3.spec index 7c6b5e7..9d3453f 100644 --- a/SPECS/iperf3.spec +++ b/SPECS/iperf3.spec @@ -1,6 +1,6 @@ Name: iperf3 Version: 3.5 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Measurement tool for TCP/UDP bandwidth performance Group: Applications/Internet @@ -12,6 +12,7 @@ BuildRequires: lksctp-tools-devel BuildRequires: openssl-devel Patch0002: 0002-udp-counters-manpage.patch +Patch0003: 0003-covscan-sctp.patch %description Iperf is a tool to measure maximum TCP bandwidth, allowing the tuning of @@ -59,6 +60,9 @@ rm -f %{buildroot}%{_libdir}/libiperf.la %{_libdir}/*.so %changelog +* Tue May 05 2020 Michal Ruprich - 3.5-6 +- Related: #1665142 - Fixing a couple of covscan issues + * Fri Mar 13 2020 Michal Ruprich - 3.5-5 - Related: #1665142 - Removing patch that deletes sctp from manpage