summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-oe/recipes-support/libsoup/libsoup-2.4/CVE-2025-4945.patch117
-rw-r--r--meta-oe/recipes-support/libsoup/libsoup-2.4_2.74.3.bb1
2 files changed, 118 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/libsoup/libsoup-2.4/CVE-2025-4945.patch b/meta-oe/recipes-support/libsoup/libsoup-2.4/CVE-2025-4945.patch
new file mode 100644
index 0000000000..c9fbdbacc8
--- /dev/null
+++ b/meta-oe/recipes-support/libsoup/libsoup-2.4/CVE-2025-4945.patch
@@ -0,0 +1,117 @@
1From 3844026f74a41dd9ccab955899e005995293d246 Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com>
3Date: Tue, 8 Jul 2025 14:58:30 +0800
4Subject: [PATCH] soup-date-utils: Add value checks for date/time parsing
5
6Reject date/time when it does not represent a valid value.
7
8Closes #448
9
10CVE: CVE-2025-4945
11Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libsoup/-/commit/8988379984e33dcc7d3aa58551db13e48755959f]
12
13Signed-off-by: Changqing Li <changqing.li@windriver.com>
14---
15 libsoup/soup-date.c | 21 +++++++++++++++------
16 tests/cookies-test.c | 10 ++++++++++
17 2 files changed, 25 insertions(+), 6 deletions(-)
18
19diff --git a/libsoup/soup-date.c b/libsoup/soup-date.c
20index 9602d1f..4c114c1 100644
21--- a/libsoup/soup-date.c
22+++ b/libsoup/soup-date.c
23@@ -284,7 +284,7 @@ parse_day (SoupDate *date, const char **date_string)
24 while (*end == ' ' || *end == '-')
25 end++;
26 *date_string = end;
27- return TRUE;
28+ return date->day >= 1 && date->day <= 31;
29 }
30
31 static inline gboolean
32@@ -324,7 +324,7 @@ parse_year (SoupDate *date, const char **date_string)
33 while (*end == ' ' || *end == '-')
34 end++;
35 *date_string = end;
36- return TRUE;
37+ return date->year > 0 && date->year < 9999;
38 }
39
40 static inline gboolean
41@@ -348,7 +348,7 @@ parse_time (SoupDate *date, const char **date_string)
42 while (*p == ' ')
43 p++;
44 *date_string = p;
45- return TRUE;
46+ return date->hour >= 0 && date->hour < 24 && date->minute >= 0 && date->minute < 60 && date->second >= 0 && date->second < 60;
47 }
48
49 static inline gboolean
50@@ -361,8 +361,15 @@ parse_timezone (SoupDate *date, const char **date_string)
51 gulong val;
52 int sign = (**date_string == '+') ? -1 : 1;
53 val = strtoul (*date_string + 1, (char **)date_string, 10);
54+ if (val > 9999)
55+ return FALSE;
56 if (**date_string == ':')
57- val = 60 * val + strtoul (*date_string + 1, (char **)date_string, 10);
58+ {
59+ gulong val2 = strtoul (*date_string + 1, (char **)date_string, 10);
60+ if (val > 99 || val2 > 99)
61+ return FALSE;
62+ val = 60 * val + val2;
63+ }
64 else
65 val = 60 * (val / 100) + (val % 100);
66 date->offset = sign * val;
67@@ -407,7 +414,8 @@ parse_textual_date (SoupDate *date, const char *date_string)
68 if (!parse_month (date, &date_string) ||
69 !parse_day (date, &date_string) ||
70 !parse_time (date, &date_string) ||
71- !parse_year (date, &date_string))
72+ !parse_year (date, &date_string) ||
73+ !g_date_valid_dmy(date->day, date->month, date->year))
74 return FALSE;
75
76 /* There shouldn't be a timezone, but check anyway */
77@@ -419,7 +427,8 @@ parse_textual_date (SoupDate *date, const char *date_string)
78 if (!parse_day (date, &date_string) ||
79 !parse_month (date, &date_string) ||
80 !parse_year (date, &date_string) ||
81- !parse_time (date, &date_string))
82+ !parse_time (date, &date_string) ||
83+ !g_date_valid_dmy(date->day, date->month, date->year))
84 return FALSE;
85
86 /* This time there *should* be a timezone, but we
87diff --git a/tests/cookies-test.c b/tests/cookies-test.c
88index 2e2a54f..6035a86 100644
89--- a/tests/cookies-test.c
90+++ b/tests/cookies-test.c
91@@ -413,6 +413,15 @@ do_remove_feature_test (void)
92 soup_uri_free (uri);
93 }
94
95+static void
96+do_cookies_parsing_int32_overflow (void)
97+{
98+ SoupCookie *cookie = soup_cookie_parse ("Age=1;expires=3Mar9 999:9:9+ 999999999-age=main=gne=", NULL);
99+ g_assert_nonnull (cookie);
100+ g_assert_null (soup_cookie_get_expires (cookie));
101+ soup_cookie_free (cookie);
102+}
103+
104 int
105 main (int argc, char **argv)
106 {
107@@ -434,6 +443,7 @@ main (int argc, char **argv)
108 g_test_add_func ("/cookies/accept-policy-subdomains", do_cookies_subdomain_policy_test);
109 g_test_add_func ("/cookies/parsing", do_cookies_parsing_test);
110 g_test_add_func ("/cookies/parsing/no-path-null-origin", do_cookies_parsing_nopath_nullorigin);
111+ g_test_add_func ("/cookies/parsing/int32-overflow", do_cookies_parsing_int32_overflow);
112 g_test_add_func ("/cookies/get-cookies/empty-host", do_get_cookies_empty_host_test);
113 g_test_add_func ("/cookies/remove-feature", do_remove_feature_test);
114 g_test_add_func ("/cookies/secure-cookies", do_cookies_strict_secure_test);
115--
1162.34.1
117
diff --git a/meta-oe/recipes-support/libsoup/libsoup-2.4_2.74.3.bb b/meta-oe/recipes-support/libsoup/libsoup-2.4_2.74.3.bb
index cbc886a2cb..68ec576d9b 100644
--- a/meta-oe/recipes-support/libsoup/libsoup-2.4_2.74.3.bb
+++ b/meta-oe/recipes-support/libsoup/libsoup-2.4_2.74.3.bb
@@ -39,6 +39,7 @@ SRC_URI = "${GNOME_MIRROR}/libsoup/${SHRT_VER}/libsoup-${PV}.tar.xz \
39 file://CVE-2025-32907.patch \ 39 file://CVE-2025-32907.patch \
40 file://CVE-2025-4948.patch \ 40 file://CVE-2025-4948.patch \
41 file://CVE-2025-4969.patch \ 41 file://CVE-2025-4969.patch \
42 file://CVE-2025-4945.patch \
42" 43"
43SRC_URI[sha256sum] = "e4b77c41cfc4c8c5a035fcdc320c7bc6cfb75ef7c5a034153df1413fa1d92f13" 44SRC_URI[sha256sum] = "e4b77c41cfc4c8c5a035fcdc320c7bc6cfb75ef7c5a034153df1413fa1d92f13"
44 45