mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00
libsoup-2.4: Fix CVE-2025-32906
Upstream-Status: Backport from1f509f31b6
&af5b9a4a39
(From OE-Core rev: 6e373ec360151b212ae6eedc4c663fb9e760ae75) Signed-off-by: Vijay Anusuri <vanusuri@mvista.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
This commit is contained in:
parent
929989c6c3
commit
adc945c074
|
@ -0,0 +1,61 @@
|
|||
From 1f509f31b6f8420a3661c3f990424ab7b9164931 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Griffis <pgriffis@igalia.com>
|
||||
Date: Tue, 11 Feb 2025 14:36:26 -0600
|
||||
Subject: [PATCH] headers: Handle parsing edge case
|
||||
|
||||
This version number is specifically crafted to pass sanity checks allowing it to go one byte out of bounds.
|
||||
|
||||
Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libsoup/-/commit/1f509f31b6f8420a3661c3f990424ab7b9164931]
|
||||
CVE: CVE-2025-32906 #Dependency Patch
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
libsoup/soup-headers.c | 2 +-
|
||||
tests/header-parsing-test.c | 12 ++++++++++++
|
||||
2 files changed, 13 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libsoup/soup-headers.c b/libsoup/soup-headers.c
|
||||
index 85385cea..9d6d00a3 100644
|
||||
--- a/libsoup/soup-headers.c
|
||||
+++ b/libsoup/soup-headers.c
|
||||
@@ -225,7 +225,7 @@ soup_headers_parse_request (const char *str,
|
||||
!g_ascii_isdigit (version[5]))
|
||||
return SOUP_STATUS_BAD_REQUEST;
|
||||
major_version = strtoul (version + 5, &p, 10);
|
||||
- if (*p != '.' || !g_ascii_isdigit (p[1]))
|
||||
+ if (p + 1 >= str + len || *p != '.' || !g_ascii_isdigit (p[1]))
|
||||
return SOUP_STATUS_BAD_REQUEST;
|
||||
minor_version = strtoul (p + 1, &p, 10);
|
||||
version_end = p;
|
||||
diff --git a/tests/header-parsing-test.c b/tests/header-parsing-test.c
|
||||
index 07ea2866..10ddb684 100644
|
||||
--- a/tests/header-parsing-test.c
|
||||
+++ b/tests/header-parsing-test.c
|
||||
@@ -6,6 +6,10 @@ typedef struct {
|
||||
const char *name, *value;
|
||||
} Header;
|
||||
|
||||
+static char unterminated_http_version[] = {
|
||||
+ 'G','E','T',' ','/',' ','H','T','T','P','/','1', '0', '0', '.'
|
||||
+};
|
||||
+
|
||||
static struct RequestTest {
|
||||
const char *description;
|
||||
const char *bugref;
|
||||
@@ -383,6 +387,14 @@ static struct RequestTest {
|
||||
{ { NULL } }
|
||||
},
|
||||
|
||||
+ /* This couldn't be a C string as going one byte over would have been safe. */
|
||||
+ { "Long HTTP version terminating at missing minor version", "https://gitlab.gnome.org/GNOME/libsoup/-/issues/404",
|
||||
+ unterminated_http_version, sizeof (unterminated_http_version),
|
||||
+ SOUP_STATUS_BAD_REQUEST,
|
||||
+ NULL, NULL, -1,
|
||||
+ { { NULL } }
|
||||
+ },
|
||||
+
|
||||
{ "Non-HTTP request", NULL,
|
||||
"GET / SOUP/1.1\r\nHost: example.com\r\n", -1,
|
||||
SOUP_STATUS_BAD_REQUEST,
|
||||
--
|
||||
GitLab
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
From af5b9a4a3945c52b940d5ac181ef51bb12011f1f Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Griffis <pgriffis@igalia.com>
|
||||
Date: Wed, 12 Feb 2025 11:30:02 -0600
|
||||
Subject: [PATCH] headers: Handle parsing only newlines
|
||||
|
||||
Closes #404
|
||||
Closes #407
|
||||
|
||||
Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libsoup/-/commit/af5b9a4a3945c52b940d5ac181ef51bb12011f1f]
|
||||
CVE: CVE-2025-32906
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
libsoup/soup-headers.c | 4 ++--
|
||||
tests/header-parsing-test.c | 13 ++++++++++++-
|
||||
2 files changed, 14 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/libsoup/soup-headers.c b/libsoup/soup-headers.c
|
||||
index 9d6d00a3..52ef2ece 100644
|
||||
--- a/libsoup/soup-headers.c
|
||||
+++ b/libsoup/soup-headers.c
|
||||
@@ -186,7 +186,7 @@ soup_headers_parse_request (const char *str,
|
||||
/* RFC 2616 4.1 "servers SHOULD ignore any empty line(s)
|
||||
* received where a Request-Line is expected."
|
||||
*/
|
||||
- while ((*str == '\r' || *str == '\n') && len > 0) {
|
||||
+ while (len > 0 && (*str == '\r' || *str == '\n')) {
|
||||
str++;
|
||||
len--;
|
||||
}
|
||||
@@ -371,7 +371,7 @@ soup_headers_parse_response (const char *str,
|
||||
* after a response, which we then see prepended to the next
|
||||
* response on that connection.
|
||||
*/
|
||||
- while ((*str == '\r' || *str == '\n') && len > 0) {
|
||||
+ while (len > 0 && (*str == '\r' || *str == '\n')) {
|
||||
str++;
|
||||
len--;
|
||||
}
|
||||
diff --git a/tests/header-parsing-test.c b/tests/header-parsing-test.c
|
||||
index 10ddb684..4faafbd6 100644
|
||||
--- a/tests/header-parsing-test.c
|
||||
+++ b/tests/header-parsing-test.c
|
||||
@@ -6,10 +6,15 @@ typedef struct {
|
||||
const char *name, *value;
|
||||
} Header;
|
||||
|
||||
+/* These are not C strings to ensure going one byte over is not safe. */
|
||||
static char unterminated_http_version[] = {
|
||||
'G','E','T',' ','/',' ','H','T','T','P','/','1', '0', '0', '.'
|
||||
};
|
||||
|
||||
+static char only_newlines[] = {
|
||||
+ '\n', '\n', '\n', '\n'
|
||||
+};
|
||||
+
|
||||
static struct RequestTest {
|
||||
const char *description;
|
||||
const char *bugref;
|
||||
@@ -387,7 +392,6 @@ static struct RequestTest {
|
||||
{ { NULL } }
|
||||
},
|
||||
|
||||
- /* This couldn't be a C string as going one byte over would have been safe. */
|
||||
{ "Long HTTP version terminating at missing minor version", "https://gitlab.gnome.org/GNOME/libsoup/-/issues/404",
|
||||
unterminated_http_version, sizeof (unterminated_http_version),
|
||||
SOUP_STATUS_BAD_REQUEST,
|
||||
@@ -457,6 +461,13 @@ static struct RequestTest {
|
||||
SOUP_STATUS_BAD_REQUEST,
|
||||
NULL, NULL, -1,
|
||||
{ { NULL } }
|
||||
+ },
|
||||
+
|
||||
+ { "Only newlines", NULL,
|
||||
+ only_newlines, sizeof (only_newlines),
|
||||
+ SOUP_STATUS_BAD_REQUEST,
|
||||
+ NULL, NULL, -1,
|
||||
+ { { NULL } }
|
||||
}
|
||||
};
|
||||
static const int num_reqtests = G_N_ELEMENTS (reqtests);
|
||||
--
|
||||
GitLab
|
||||
|
|
@ -19,6 +19,8 @@ SRC_URI = "${GNOME_MIRROR}/libsoup/${SHRT_VER}/libsoup-${PV}.tar.xz \
|
|||
file://CVE-2024-52532-1.patch \
|
||||
file://CVE-2024-52532-2.patch \
|
||||
file://CVE-2024-52532-3.patch \
|
||||
file://CVE-2025-32906-1.patch \
|
||||
file://CVE-2025-32906-2.patch \
|
||||
"
|
||||
SRC_URI[sha256sum] = "e4b77c41cfc4c8c5a035fcdc320c7bc6cfb75ef7c5a034153df1413fa1d92f13"
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user