diff options
| -rw-r--r-- | meta/recipes-support/libsoup/libsoup/CVE-2025-4969.patch | 78 | ||||
| -rw-r--r-- | meta/recipes-support/libsoup/libsoup_3.6.5.bb | 1 |
2 files changed, 79 insertions, 0 deletions
diff --git a/meta/recipes-support/libsoup/libsoup/CVE-2025-4969.patch b/meta/recipes-support/libsoup/libsoup/CVE-2025-4969.patch new file mode 100644 index 0000000000..97702a3d08 --- /dev/null +++ b/meta/recipes-support/libsoup/libsoup/CVE-2025-4969.patch | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | From e8ef88ed86929c9a0dc343a4c7d29a8f2bcf400f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Milan Crha <mcrha@redhat.com> | ||
| 3 | Date: Mon, 19 May 2025 17:48:27 +0200 | ||
| 4 | Subject: [PATCH] soup-multipart: Verify array bounds before accessing its | ||
| 5 | members | ||
| 6 | |||
| 7 | The boundary could be at a place which, calculated, pointed | ||
| 8 | before the beginning of the array. Check the bounds, to avoid | ||
| 9 | read out of the array bounds. | ||
| 10 | |||
| 11 | Closes https://gitlab.gnome.org/GNOME/libsoup/-/issues/447 | ||
| 12 | |||
| 13 | CVE: CVE-2025-4969 | ||
| 14 | Upstream-Status: Backport | ||
| 15 | [https://gitlab.gnome.org/GNOME/libsoup/-/merge_requests/467/commits] | ||
| 16 | |||
| 17 | Signed-off-by: Changqing Li <changqing.li@windriver.com> | ||
| 18 | --- | ||
| 19 | libsoup/soup-multipart.c | 2 +- | ||
| 20 | tests/multipart-test.c | 22 ++++++++++++++++++++++ | ||
| 21 | 2 files changed, 23 insertions(+), 1 deletion(-) | ||
| 22 | |||
| 23 | diff --git a/libsoup/soup-multipart.c b/libsoup/soup-multipart.c | ||
| 24 | index a587fe7..27257e4 100644 | ||
| 25 | --- a/libsoup/soup-multipart.c | ||
| 26 | +++ b/libsoup/soup-multipart.c | ||
| 27 | @@ -104,7 +104,7 @@ find_boundary (const char *start, const char *end, | ||
| 28 | continue; | ||
| 29 | |||
| 30 | /* Check that it's at start of line */ | ||
| 31 | - if (!(b == start || (b[-1] == '\n' && b[-2] == '\r'))) | ||
| 32 | + if (!(b == start || (b - start >= 2 && b[-1] == '\n' && b[-2] == '\r'))) | ||
| 33 | continue; | ||
| 34 | |||
| 35 | /* Check for "--" or "\r\n" after boundary */ | ||
| 36 | diff --git a/tests/multipart-test.c b/tests/multipart-test.c | ||
| 37 | index 92b673e..3792563 100644 | ||
| 38 | --- a/tests/multipart-test.c | ||
| 39 | +++ b/tests/multipart-test.c | ||
| 40 | @@ -527,6 +527,27 @@ test_multipart_bounds_bad (void) | ||
| 41 | g_bytes_unref (bytes); | ||
| 42 | } | ||
| 43 | |||
| 44 | +static void | ||
| 45 | +test_multipart_bounds_bad_2 (void) | ||
| 46 | +{ | ||
| 47 | + SoupMultipart *multipart; | ||
| 48 | + SoupMessageHeaders *headers; | ||
| 49 | + GBytes *bytes; | ||
| 50 | + const char *raw_data = "\n--123\r\nline\r\n--123--\r"; | ||
| 51 | + | ||
| 52 | + headers = soup_message_headers_new (SOUP_MESSAGE_HEADERS_MULTIPART); | ||
| 53 | + soup_message_headers_append (headers, "Content-Type", "multipart/mixed; boundary=\"123\""); | ||
| 54 | + | ||
| 55 | + bytes = g_bytes_new (raw_data, strlen (raw_data)); | ||
| 56 | + | ||
| 57 | + multipart = soup_multipart_new_from_message (headers, bytes); | ||
| 58 | + g_assert_nonnull (multipart); | ||
| 59 | + | ||
| 60 | + soup_multipart_free (multipart); | ||
| 61 | + soup_message_headers_unref (headers); | ||
| 62 | + g_bytes_unref (bytes); | ||
| 63 | +} | ||
| 64 | + | ||
| 65 | static void | ||
| 66 | test_multipart_too_large (void) | ||
| 67 | { | ||
| 68 | @@ -595,6 +616,7 @@ main (int argc, char **argv) | ||
| 69 | g_test_add_data_func ("/multipart/async-small-reads", GINT_TO_POINTER (ASYNC_MULTIPART_SMALL_READS), test_multipart); | ||
| 70 | g_test_add_func ("/multipart/bounds-good", test_multipart_bounds_good); | ||
| 71 | g_test_add_func ("/multipart/bounds-bad", test_multipart_bounds_bad); | ||
| 72 | + g_test_add_func ("/multipart/bounds-bad-2", test_multipart_bounds_bad_2); | ||
| 73 | g_test_add_func ("/multipart/too-large", test_multipart_too_large); | ||
| 74 | |||
| 75 | ret = g_test_run (); | ||
| 76 | -- | ||
| 77 | 2.34.1 | ||
| 78 | |||
diff --git a/meta/recipes-support/libsoup/libsoup_3.6.5.bb b/meta/recipes-support/libsoup/libsoup_3.6.5.bb index 772e21e09b..457a30ec70 100644 --- a/meta/recipes-support/libsoup/libsoup_3.6.5.bb +++ b/meta/recipes-support/libsoup/libsoup_3.6.5.bb | |||
| @@ -19,6 +19,7 @@ SRC_URI = "${GNOME_MIRROR}/libsoup/${SHRT_VER}/libsoup-${PV}.tar.xz \ | |||
| 19 | file://CVE-2025-32908-1.patch \ | 19 | file://CVE-2025-32908-1.patch \ |
| 20 | file://CVE-2025-32908-2.patch \ | 20 | file://CVE-2025-32908-2.patch \ |
| 21 | file://CVE-2025-4948.patch \ | 21 | file://CVE-2025-4948.patch \ |
| 22 | file://CVE-2025-4969.patch \ | ||
| 22 | " | 23 | " |
| 23 | SRC_URI[sha256sum] = "6891765aac3e949017945c3eaebd8cc8216df772456dc9f460976fbdb7ada234" | 24 | SRC_URI[sha256sum] = "6891765aac3e949017945c3eaebd8cc8216df772456dc9f460976fbdb7ada234" |
| 24 | 25 | ||
