|
| 1 | +From 8f1e56bbb5a192892e026de3c4ee8914aa120d69 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Alynx Zhou < [email protected]> |
| 3 | +Date: Sat, 11 Oct 2025 15:52:47 +0800 |
| 4 | +Subject: [PATCH] cookies: Avoid expires attribute if date is invalid |
| 5 | + |
| 6 | +According to CVE-2025-11021, we may get invalid on processing date |
| 7 | +string with timezone offset, this commit will ignore it. |
| 8 | + |
| 9 | +Closes #459 |
| 10 | + |
| 11 | +Signed-off-by: Azure Linux Security Servicing Account < [email protected]> |
| 12 | +Upstream-reference: https://gitlab.gnome.org/GNOME/libsoup/-/commit/9e1a427d2f047439d0320defe1593e6352595788.patch |
| 13 | +--- |
| 14 | + libsoup/cookies/soup-cookie.c | 9 +++++---- |
| 15 | + libsoup/soup-date-utils.c | 3 +++ |
| 16 | + 2 files changed, 8 insertions(+), 4 deletions(-) |
| 17 | + |
| 18 | +diff --git a/libsoup/cookies/soup-cookie.c b/libsoup/cookies/soup-cookie.c |
| 19 | +index 021d527..093e451 100644 |
| 20 | +--- a/libsoup/cookies/soup-cookie.c |
| 21 | ++++ b/libsoup/cookies/soup-cookie.c |
| 22 | +@@ -733,12 +733,13 @@ serialize_cookie (SoupCookie *cookie, GString *header, gboolean set_cookie) |
| 23 | + |
| 24 | + if (cookie->expires) { |
| 25 | + char *timestamp; |
| 26 | +- |
| 27 | +- g_string_append (header, "; expires="); |
| 28 | + timestamp = soup_date_time_to_string (cookie->expires, |
| 29 | + SOUP_DATE_COOKIE); |
| 30 | +- g_string_append (header, timestamp); |
| 31 | +- g_free (timestamp); |
| 32 | ++ if (timestamp) { |
| 33 | ++ g_string_append (header, "; expires="); |
| 34 | ++ g_string_append (header, timestamp); |
| 35 | ++ g_free (timestamp); |
| 36 | ++ } |
| 37 | + } |
| 38 | + if (cookie->path) { |
| 39 | + g_string_append (header, "; path="); |
| 40 | +diff --git a/libsoup/soup-date-utils.c b/libsoup/soup-date-utils.c |
| 41 | +index 061057e..27fa8e3 100644 |
| 42 | +--- a/libsoup/soup-date-utils.c |
| 43 | ++++ b/libsoup/soup-date-utils.c |
| 44 | +@@ -104,6 +104,9 @@ soup_date_time_to_string (GDateTime *date, |
| 45 | + char *date_format; |
| 46 | + char *formatted_date; |
| 47 | + |
| 48 | ++ if (!utcdate) |
| 49 | ++ return NULL; |
| 50 | ++ |
| 51 | + // We insert days/months ourselves to avoid locale specific formatting |
| 52 | + if (format == SOUP_DATE_HTTP) { |
| 53 | + /* "Sun, 06 Nov 1994 08:49:37 GMT" */ |
| 54 | +-- |
| 55 | +2.45.4 |
| 56 | + |
0 commit comments