summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/libsoup/libsoup-2.4/CVE-2025-14523.patch
blob: 7815dba55aa9eacf1a6c3517bc37b2f9dbc8d599 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From d6028a6e6a8417b7fb6c89f6c10fb94781435ee6 Mon Sep 17 00:00:00 2001
From: Changqing Li <changqing.li@windriver.com>
Date: Wed, 4 Feb 2026 15:08:50 +0800
Subject: [PATCH] Reject duplicate Host headers (for libsoup 2)

This is a simplified version of my patch for libsoup 3:

!491

Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libsoup/-/commit/d3db5a6f8f03e1f0133754872877c92c0284c472]
CVE: CVE-2025-14523

This patch is a MR for branch 2-74, but not merged yet, maybe it will
not be merged.

Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
 libsoup/soup-headers.c         | 3 +++
 libsoup/soup-message-headers.c | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/libsoup/soup-headers.c b/libsoup/soup-headers.c
index ea2f986..6cd3dad 100644
--- a/libsoup/soup-headers.c
+++ b/libsoup/soup-headers.c
@@ -138,6 +138,9 @@ soup_headers_parse (const char *str, int len, SoupMessageHeaders *dest)
 		for (p = strchr (value, '\r'); p; p = strchr (p, '\r'))
 			*p = ' ';
 
+		if (g_ascii_strcasecmp (name, "Host") == 0 && soup_message_headers_get_one (dest, "Host"))
+			goto done;
+
 		soup_message_headers_append (dest, name, value);
         }
 	success = TRUE;
diff --git a/libsoup/soup-message-headers.c b/libsoup/soup-message-headers.c
index f612bff..bb20bbb 100644
--- a/libsoup/soup-message-headers.c
+++ b/libsoup/soup-message-headers.c
@@ -220,6 +220,9 @@ soup_message_headers_append (SoupMessageHeaders *hdrs,
 	}
 #endif
 
+	if (g_ascii_strcasecmp (name, "Host") == 0 && soup_message_headers_get_one (hdrs, "Host"))
+		return;
+
 	header.name = intern_header_name (name, &setter);
 	header.value = g_strdup (value);
 	g_array_append_val (hdrs->array, header);
-- 
2.34.1