1
- From 86b094a7eef8930935d7888d0f4f70c80552c367 Mon Sep 17 00:00:00 2001
1
+ From 3d304a13b105ee1772a81e5bbe2a9013c1dd5ad8 Mon Sep 17 00:00:00 2001
2
2
From: Azure Linux Security Servicing Account
3
3
4
- Date: Tue, 29 Jul 2025 07:05:27 +0000
4
+ Date: Tue, 29 Jul 2025 06:55:51 +0000
5
5
Subject: [PATCH] Fix CVE CVE-2025-48964 in iputils
6
6
7
7
Upstream Patch Reference: https://github.com/iputils/iputils/commit/afa36390394a6e0cceba03b52b59b6d41710608c.patch
8
+
8
9
---
9
- ping/ping.h | 2 +-
10
- ping/ping_common.c | 8 ++++----
11
- 2 files changed, 5 insertions(+), 5 deletions(-)
10
+ iputils_common.h | 2 ++
11
+ ping/ping.h | 2 +-
12
+ ping/ping_common.c | 45 +++++++++++++++++++++++++++++++--------------
13
+ 3 files changed, 34 insertions(+), 15 deletions(-)
12
14
15
+ diff --git a/iputils_common.h b/iputils_common.h
16
+ index 49e790d..d3ba1d9 100644
17
+ --- a/iputils_common.h
18
+ +++ b/iputils_common.h
19
+ @@ -10,6 +10,8 @@
20
+ !!__builtin_types_compatible_p(__typeof__(arr), \
21
+ __typeof__(&arr[0]))])) * 0)
22
+
23
+ + #define TV_SEC_MAX_VAL (INT32_MAX/1000001)
24
+ +
25
+ #ifdef __GNUC__
26
+ # define iputils_attribute_format(t, n, m) __attribute__((__format__ (t, n, m)))
27
+ #else
13
28
diff --git a/ping/ping.h b/ping/ping.h
14
29
index a40c8f8..f5a5bb8 100644
15
30
--- a/ping/ping.h
@@ -24,7 +39,7 @@ index a40c8f8..f5a5bb8 100644
24
39
uint16_t acked;
25
40
int pipesize;
26
41
diff --git a/ping/ping_common.c b/ping/ping_common.c
27
- index 73da26c..8fe2a1a 100644
42
+ index 73da26c..0756c3e 100644
28
43
--- a/ping/ping_common.c
29
44
+++ b/ping/ping_common.c
30
45
@@ -282,7 +282,7 @@ int __schedule_exit(int next)
@@ -36,7 +51,51 @@ index 73da26c..8fe2a1a 100644
36
51
37
52
rts->interval = (est + rts->rtt_addend + 500) / 1000;
38
53
if (rts->uid && rts->interval < MIN_USER_INTERVAL_MS)
39
- @@ -762,7 +762,7 @@ restamp:
54
+ @@ -744,16 +744,33 @@ int gather_statistics(struct ping_rts *rts, uint8_t *icmph, int icmplen,
55
+
56
+ restamp:
57
+ tvsub(tv, &tmp_tv);
58
+ - triptime = tv->tv_sec * 1000000 + tv->tv_usec;
59
+ - if (triptime < 0) {
60
+ - error(0, 0, _("Warning: time of day goes back (%ldus), taking countermeasures"), triptime);
61
+ - triptime = 0;
62
+ - if (!rts->opt_latency) {
63
+ - gettimeofday(tv, NULL);
64
+ - rts->opt_latency = 1;
65
+ - goto restamp;
66
+ - }
67
+ - }
68
+ +
69
+ + if (tv->tv_usec >= 1000000) {
70
+ + error(0, 0, _("Warning: invalid tv_usec %ld us"), tv->tv_usec);
71
+ + tv->tv_usec = 999999;
72
+ + }
73
+ +
74
+ + if (tv->tv_usec < 0) {
75
+ + error(0, 0, _("Warning: invalid tv_usec %ld us"), tv->tv_usec);
76
+ + tv->tv_usec = 0;
77
+ + }
78
+ +
79
+ + if (tv->tv_sec > TV_SEC_MAX_VAL) {
80
+ + error(0, 0, _("Warning: invalid tv_sec %ld s"), tv->tv_sec);
81
+ + triptime = 0;
82
+ + } else if (tv->tv_sec < 0) {
83
+ + error(0, 0, _("Warning: time of day goes back (%ld s), taking countermeasures"), tv->tv_sec);
84
+ + triptime = 0;
85
+ + if (!rts->opt_latency) {
86
+ + gettimeofday(tv, NULL);
87
+ + rts->opt_latency = 1;
88
+ + goto restamp;
89
+ + }
90
+ + } else {
91
+ + triptime = tv->tv_sec * 1000000 + tv->tv_usec;
92
+ + }
93
+ +
94
+ +
95
+ if (!csfailed) {
96
+ rts->tsum += triptime;
97
+ rts->tsum2 += (double)((long long)triptime * (long long)triptime);
98
+ @@ -762,7 +779,7 @@ restamp:
40
99
if (triptime > rts->tmax)
41
100
rts->tmax = triptime;
42
101
if (!rts->rtt)
@@ -45,7 +104,7 @@ index 73da26c..8fe2a1a 100644
45
104
else
46
105
rts->rtt += triptime - rts->rtt / 8;
47
106
if (rts->opt_adaptive)
48
- @@ -932,7 +932 ,7 @@ int finish(struct ping_rts *rts)
107
+ @@ -932,7 +949 ,7 @@ int finish(struct ping_rts *rts)
49
108
int ipg = (1000000 * (long long)tv.tv_sec + tv.tv_nsec / 1000) / (rts->ntransmitted - 1);
50
109
51
110
printf(_("%sipg/ewma %d.%03d/%d.%03d ms"),
@@ -54,7 +113,7 @@ index 73da26c..8fe2a1a 100644
54
113
}
55
114
putchar('\n');
56
115
return (!rts->nreceived || (rts->deadline && rts->nreceived < rts->npackets));
57
- @@ -957,7 +957 ,7 @@ void status(struct ping_rts *rts)
116
+ @@ -957,7 +974 ,7 @@ void status(struct ping_rts *rts)
58
117
fprintf(stderr, _(", min/avg/ewma/max = %ld.%03ld/%lu.%03ld/%d.%03d/%ld.%03ld ms"),
59
118
(long)rts->tmin / 1000, (long)rts->tmin % 1000,
60
119
tavg / 1000, tavg % 1000,
@@ -64,5 +123,5 @@ index 73da26c..8fe2a1a 100644
64
123
fprintf(stderr, "\n");
65
124
}
66
125
- -
67
- 2.45.4
126
+ 2.45.2
68
127
0 commit comments