|
| 1 | +From c51318216c96ae745499c75d42d2399f8b3b0c7e Mon Sep 17 00:00:00 2001 |
| 2 | +From: Azure Linux Security Servicing Account |
| 3 | + |
| 4 | +Date: Mon, 4 Aug 2025 11:21:06 +0000 |
| 5 | +Subject: [PATCH] Fix CVE CVE-2025-54351 in iperf3 |
| 6 | + |
| 7 | +Upstream Patch Reference: https://github.com/esnet/iperf/commit/969b7f70c447513e92c9798f22e82b40ebc53bf0.patch |
| 8 | +--- |
| 9 | + iperf-3.17.1/src/net.c.rej | 68 ++++++++++++++++++++++++++++++++++++++ |
| 10 | + 1 file changed, 68 insertions(+) |
| 11 | + create mode 100644 iperf-3.17.1/src/net.c.rej |
| 12 | + |
| 13 | +diff --git a/iperf-3.17.1/src/net.c.rej b/iperf-3.17.1/src/net.c.rej |
| 14 | +new file mode 100644 |
| 15 | +index 0000000..5471a3e |
| 16 | +--- /dev/null |
| 17 | ++++ b/iperf-3.17.1/src/net.c.rej |
| 18 | +@@ -0,0 +1,68 @@ |
| 19 | ++--- net.c |
| 20 | +++++ net.c |
| 21 | ++@@ -383,9 +383,7 @@ int |
| 22 | ++ Nrecv(int fd, char *buf, size_t count, int prot, int sock_opt) |
| 23 | ++ { |
| 24 | ++ register ssize_t r; |
| 25 | ++- // `nleft` must be signed as it may get negative value for SKIP-RX-COPY UDP (MSG_TRUNC in sock_opt). |
| 26 | ++- register ssize_t nleft = count; |
| 27 | ++- register size_t total = 0; |
| 28 | +++ register size_t nleft = count; |
| 29 | ++ struct iperf_time ftimeout = { 0, 0 }; |
| 30 | ++ |
| 31 | ++ fd_set rfdset; |
| 32 | ++@@ -428,9 +426,15 @@ Nrecv(int fd, char *buf, size_t count, int prot, int sock_opt) |
| 33 | ++ } else if (r == 0) |
| 34 | ++ break; |
| 35 | ++ |
| 36 | ++- total += r; |
| 37 | ++- nleft -= r; |
| 38 | ++- buf += r; |
| 39 | +++ if (sock_opt & MSG_TRUNC) { |
| 40 | +++ size_t bytes_copied = (r > nleft)? nleft: r; |
| 41 | +++ nleft -= bytes_copied; |
| 42 | +++ buf += bytes_copied; |
| 43 | +++ } |
| 44 | +++ else { |
| 45 | +++ nleft -= r; |
| 46 | +++ buf += r; |
| 47 | +++ } |
| 48 | ++ |
| 49 | ++ /* |
| 50 | ++ * We need some more bytes but don't want to wait around |
| 51 | ++@@ -465,7 +469,7 @@ Nrecv(int fd, char *buf, size_t count, int prot, int sock_opt) |
| 52 | ++ } |
| 53 | ++ } |
| 54 | ++ } |
| 55 | ++- return total; |
| 56 | +++ return count - nleft; |
| 57 | ++ } |
| 58 | ++ |
| 59 | ++ /********************************************************************/ |
| 60 | ++@@ -491,6 +495,7 @@ Nrecv_no_select(int fd, char *buf, size_t count, int prot, int sock_opt) |
| 61 | ++ r = recv(fd, buf, nleft, sock_opt); |
| 62 | ++ else |
| 63 | ++ r = read(fd, buf, nleft); |
| 64 | +++ |
| 65 | ++ if (r < 0) { |
| 66 | ++ /* XXX EWOULDBLOCK can't happen without non-blocking sockets */ |
| 67 | ++ if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) |
| 68 | ++@@ -500,8 +505,16 @@ Nrecv_no_select(int fd, char *buf, size_t count, int prot, int sock_opt) |
| 69 | ++ } else if (r == 0) |
| 70 | ++ break; |
| 71 | ++ |
| 72 | ++- nleft -= r; |
| 73 | ++- buf += r; |
| 74 | +++ if (sock_opt & MSG_TRUNC) { |
| 75 | +++ size_t bytes_copied = (r > nleft)? nleft: r; |
| 76 | +++ nleft -= bytes_copied; |
| 77 | +++ buf += bytes_copied; |
| 78 | +++ } |
| 79 | +++ else { |
| 80 | +++ nleft -= r; |
| 81 | +++ buf += r; |
| 82 | +++ } |
| 83 | +++ |
| 84 | ++ |
| 85 | ++ } |
| 86 | ++ return count - nleft; |
| 87 | +-- |
| 88 | +2.45.4 |
| 89 | + |
0 commit comments