mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00
libsoup: Fix CVE-2025-32914
Upstream-Status: Backport
[5bfcf81575
]
(From OE-Core rev: 6dd125b619974c8102b3050900781c22c2db4b10)
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
This commit is contained in:
parent
86ea2699ac
commit
c418c7ec51
111
meta/recipes-support/libsoup/libsoup-3.4.4/CVE-2025-32914.patch
Normal file
111
meta/recipes-support/libsoup/libsoup-3.4.4/CVE-2025-32914.patch
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
From 5bfcf8157597f2d327050114fb37ff600004dbcf Mon Sep 17 00:00:00 2001
|
||||||
|
From: Milan Crha <mcrha@redhat.com>
|
||||||
|
Date: Tue, 15 Apr 2025 09:03:00 +0200
|
||||||
|
Subject: [PATCH] multipart: Fix read out of buffer bounds under
|
||||||
|
soup_multipart_new_from_message()
|
||||||
|
|
||||||
|
This is CVE-2025-32914, special crafted input can cause read out of buffer bounds
|
||||||
|
of the body argument.
|
||||||
|
|
||||||
|
Closes #436
|
||||||
|
|
||||||
|
Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libsoup/-/commit/5bfcf8157597f2d327050114fb37ff600004dbcf]
|
||||||
|
CVE: CVE-2025-32914
|
||||||
|
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||||
|
---
|
||||||
|
libsoup/soup-multipart.c | 2 +-
|
||||||
|
tests/multipart-test.c | 58 ++++++++++++++++++++++++++++++++++++++++
|
||||||
|
2 files changed, 59 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/libsoup/soup-multipart.c b/libsoup/soup-multipart.c
|
||||||
|
index 2421c91f8..102ce3722 100644
|
||||||
|
--- a/libsoup/soup-multipart.c
|
||||||
|
+++ b/libsoup/soup-multipart.c
|
||||||
|
@@ -173,7 +173,7 @@ soup_multipart_new_from_message (SoupMessageHeaders *headers,
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
- split = strstr (start, "\r\n\r\n");
|
||||||
|
+ split = g_strstr_len (start, body_end - start, "\r\n\r\n");
|
||||||
|
if (!split || split > end) {
|
||||||
|
soup_multipart_free (multipart);
|
||||||
|
return NULL;
|
||||||
|
diff --git a/tests/multipart-test.c b/tests/multipart-test.c
|
||||||
|
index 2c0e7e969..f5b986889 100644
|
||||||
|
--- a/tests/multipart-test.c
|
||||||
|
+++ b/tests/multipart-test.c
|
||||||
|
@@ -471,6 +471,62 @@ test_multipart (gconstpointer data)
|
||||||
|
loop = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void
|
||||||
|
+test_multipart_bounds_good (void)
|
||||||
|
+{
|
||||||
|
+ #define TEXT "line1\r\nline2"
|
||||||
|
+ SoupMultipart *multipart;
|
||||||
|
+ SoupMessageHeaders *headers, *set_headers = NULL;
|
||||||
|
+ GBytes *bytes, *set_bytes = NULL;
|
||||||
|
+ const char *raw_data = "--123\r\nContent-Type: text/plain;\r\n\r\n" TEXT "\r\n--123--\r\n";
|
||||||
|
+ gboolean success;
|
||||||
|
+
|
||||||
|
+ headers = soup_message_headers_new (SOUP_MESSAGE_HEADERS_MULTIPART);
|
||||||
|
+ soup_message_headers_append (headers, "Content-Type", "multipart/mixed; boundary=\"123\"");
|
||||||
|
+
|
||||||
|
+ bytes = g_bytes_new (raw_data, strlen (raw_data));
|
||||||
|
+
|
||||||
|
+ multipart = soup_multipart_new_from_message (headers, bytes);
|
||||||
|
+
|
||||||
|
+ g_assert_nonnull (multipart);
|
||||||
|
+ g_assert_cmpint (soup_multipart_get_length (multipart), ==, 1);
|
||||||
|
+ success = soup_multipart_get_part (multipart, 0, &set_headers, &set_bytes);
|
||||||
|
+ g_assert_true (success);
|
||||||
|
+ g_assert_nonnull (set_headers);
|
||||||
|
+ g_assert_nonnull (set_bytes);
|
||||||
|
+ g_assert_cmpint (strlen (TEXT), ==, g_bytes_get_size (set_bytes));
|
||||||
|
+ g_assert_cmpstr ("text/plain", ==, soup_message_headers_get_content_type (set_headers, NULL));
|
||||||
|
+ g_assert_cmpmem (TEXT, strlen (TEXT), g_bytes_get_data (set_bytes, NULL), g_bytes_get_size (set_bytes));
|
||||||
|
+
|
||||||
|
+ soup_message_headers_unref (headers);
|
||||||
|
+ g_bytes_unref (bytes);
|
||||||
|
+
|
||||||
|
+ soup_multipart_free (multipart);
|
||||||
|
+
|
||||||
|
+ #undef TEXT
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+test_multipart_bounds_bad (void)
|
||||||
|
+{
|
||||||
|
+ SoupMultipart *multipart;
|
||||||
|
+ SoupMessageHeaders *headers;
|
||||||
|
+ GBytes *bytes;
|
||||||
|
+ const char *raw_data = "--123\r\nContent-Type: text/plain;\r\nline1\r\nline2\r\n--123--\r\n";
|
||||||
|
+
|
||||||
|
+ headers = soup_message_headers_new (SOUP_MESSAGE_HEADERS_MULTIPART);
|
||||||
|
+ soup_message_headers_append (headers, "Content-Type", "multipart/mixed; boundary=\"123\"");
|
||||||
|
+
|
||||||
|
+ bytes = g_bytes_new (raw_data, strlen (raw_data));
|
||||||
|
+
|
||||||
|
+ /* it did read out of raw_data/bytes bounds */
|
||||||
|
+ multipart = soup_multipart_new_from_message (headers, bytes);
|
||||||
|
+ g_assert_null (multipart);
|
||||||
|
+
|
||||||
|
+ soup_message_headers_unref (headers);
|
||||||
|
+ g_bytes_unref (bytes);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
int
|
||||||
|
main (int argc, char **argv)
|
||||||
|
{
|
||||||
|
@@ -498,6 +554,8 @@ main (int argc, char **argv)
|
||||||
|
g_test_add_data_func ("/multipart/sync", GINT_TO_POINTER (SYNC_MULTIPART), test_multipart);
|
||||||
|
g_test_add_data_func ("/multipart/async", GINT_TO_POINTER (ASYNC_MULTIPART), test_multipart);
|
||||||
|
g_test_add_data_func ("/multipart/async-small-reads", GINT_TO_POINTER (ASYNC_MULTIPART_SMALL_READS), test_multipart);
|
||||||
|
+ g_test_add_func ("/multipart/bounds-good", test_multipart_bounds_good);
|
||||||
|
+ g_test_add_func ("/multipart/bounds-bad", test_multipart_bounds_bad);
|
||||||
|
|
||||||
|
ret = g_test_run ();
|
||||||
|
|
||||||
|
--
|
||||||
|
GitLab
|
||||||
|
|
|
@ -29,6 +29,7 @@ SRC_URI = "${GNOME_MIRROR}/libsoup/${SHRT_VER}/libsoup-${PV}.tar.xz \
|
||||||
file://CVE-2025-32906-1.patch \
|
file://CVE-2025-32906-1.patch \
|
||||||
file://CVE-2025-32906-2.patch \
|
file://CVE-2025-32906-2.patch \
|
||||||
file://CVE-2025-46420.patch \
|
file://CVE-2025-46420.patch \
|
||||||
|
file://CVE-2025-32914.patch \
|
||||||
"
|
"
|
||||||
SRC_URI[sha256sum] = "291c67725f36ed90ea43efff25064b69c5a2d1981488477c05c481a3b4b0c5aa"
|
SRC_URI[sha256sum] = "291c67725f36ed90ea43efff25064b69c5a2d1981488477c05c481a3b4b0c5aa"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user