Skip to content

Commit 9af7a38

Browse files
committed
(PA-6878) Patch agent-runtime-7.x and main Curl for CVE-2024-7264
1 parent d9873e5 commit 9af7a38

File tree

3 files changed

+97
-3
lines changed

3 files changed

+97
-3
lines changed

configs/components/curl.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
case version
77
when '7.88.1'
88
pkg.sha256sum 'cdb38b72e36bc5d33d5b8810f8018ece1baa29a8f215b4495e495ded82bbf3c7'
9-
when '8.7.1'
10-
pkg.sha256sum 'f91249c87f68ea00cf27c44fdfa5a78423e41e71b7d408e5901a9896d905c495'
9+
when '8.9.1'
10+
pkg.sha256sum '291124a007ee5111997825940b3876b3048f7d31e73e9caa681b80fe48b2dcd5'
1111
else
1212
raise "curl version #{version} has not been configured; Cannot continue."
1313
end
@@ -47,6 +47,7 @@
4747
pkg.apply_patch 'resources/patches/curl/CVE-2023-46218.patch'
4848
pkg.apply_patch 'resources/patches/curl/CVE-2024-2004.patch'
4949
pkg.apply_patch 'resources/patches/curl/CVE-2024-2398.patch'
50+
pkg.apply_patch 'resources/patches/curl/CVE-2024-7264.patch'
5051
end
5152

5253
configure_options = []

configs/projects/agent-runtime-main.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
proj.setting :augeas_version, '1.14.1'
1515
end
1616

17-
proj.setting :curl_version, '8.7.1'
17+
proj.setting :curl_version, '8.9.1'
1818

1919
########
2020
# Load shared agent settings
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
diff --git a/lib/vtls/x509asn1.c b/lib/vtls/x509asn1.c
2+
index 39e4fb33b..7e2e3d724 100644
3+
--- a/lib/vtls/x509asn1.c
4+
+++ b/lib/vtls/x509asn1.c
5+
@@ -566,28 +566,40 @@ static const char *GTime2str(const char *beg, const char *end)
6+
tzp = fracp;
7+
fracl = 0;
8+
if(fracp < end && (*fracp == '.' || *fracp == ',')) {
9+
- fracp++;
10+
- do
11+
+ /* Have fractional seconds, e.g. "[.,]\d+". How many? */
12+
+ fracp++; /* should be a digit char or BAD ARGUMENT */
13+
+ tzp = fracp;
14+
+ while(tzp < end && ISDIGIT(*tzp))
15+
tzp++;
16+
- while(tzp < end && *tzp >= '0' && *tzp <= '9');
17+
- /* Strip leading zeroes in fractional seconds. */
18+
- for(fracl = tzp - fracp - 1; fracl && fracp[fracl - 1] == '0'; fracl--)
19+
- ;
20+
+ if(tzp == fracp) /* never looped, no digit after [.,] */
21+
+ return CURLE_BAD_FUNCTION_ARGUMENT;
22+
+ fracl = tzp - fracp; /* number of fractional sec digits */
23+
+ DEBUGASSERT(fracl > 0);
24+
+ /* Strip trailing zeroes in fractional seconds.
25+
+ * May reduce fracl to 0 if only '0's are present. */
26+
+ while(fracl && fracp[fracl - 1] == '0')
27+
+ fracl--;
28+
}
29+
30+
/* Process timezone. */
31+
- if(tzp >= end)
32+
- ; /* Nothing to do. */
33+
+ if(tzp >= end) {
34+
+ sep = " ";
35+
+ tzp = "GMT";
36+
+ tzl = 3;
37+
+ }
38+
+ else if((*tzp == '+') || (*tzp == '-')) {
39+
+ sep = " UTC";
40+
+ tzl = end - tzp;
41+
+ } /* Nothing to do. */
42+
else if(*tzp == 'Z') {
43+
tzp = " GMT";
44+
end = tzp + 4;
45+
}
46+
else {
47+
sep = " ";
48+
- tzp++;
49+
+ tzl = end - tzp;
50+
}
51+
52+
- tzl = end - tzp;
53+
return curl_maprintf("%.4s-%.2s-%.2s %.2s:%.2s:%c%c%s%.*s%s%.*s",
54+
beg, beg + 4, beg + 6,
55+
beg + 8, beg + 10, sec1, sec2,
56+
@@ -595,6 +607,15 @@ static const char *GTime2str(const char *beg, const char *end)
57+
sep, (int)tzl, tzp);
58+
}
59+
60+
+#ifdef UNITTESTS
61+
+/* used by unit1656.c */
62+
+CURLcode Curl_x509_GTime2str(struct dynbuf *store,
63+
+ const char *beg, const char *end)
64+
+{
65+
+ return GTime2str(store, beg, end);
66+
+}
67+
+#endif
68+
+
69+
/*
70+
* Convert an ASN.1 UTC time to a printable string.
71+
* Return the dynamically allocated string, or NULL if an error occurs.
72+
diff --git a/lib/vtls/x509asn1.h b/lib/vtls/x509asn1.h
73+
index 5496de40e..93925718c 100644
74+
--- a/lib/vtls/x509asn1.h
75+
+++ b/lib/vtls/x509asn1.h
76+
@@ -76,6 +76,17 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data, int certnum,
77+
const char *beg, const char *end);
78+
CURLcode Curl_verifyhost(struct Curl_cfilter *cf, struct Curl_easy *data,
79+
const char *beg, const char *end);
80+
+
81+
+#ifdef UNITTESTS
82+
+#if defined(USE_GNUTLS) || defined(USE_SCHANNEL) || defined(USE_SECTRANSP) || \
83+
+ defined(USE_MBEDTLS)
84+
+
85+
+/* used by unit1656.c */
86+
+CURLcode Curl_x509_GTime2str(struct dynbuf *store,
87+
+ const char *beg, const char *end);
88+
+#endif
89+
+#endif
90+
+
91+
#endif /* USE_GSKIT or USE_NSS or USE_GNUTLS or USE_WOLFSSL or USE_SCHANNEL
92+
* or USE_SECTRANSP */
93+
#endif /* HEADER_CURL_X509ASN1_H */

0 commit comments

Comments
 (0)