diff options
Diffstat (limited to 'meta/recipes-connectivity/connman/connman/CVE-2023-28488.patch')
-rw-r--r-- | meta/recipes-connectivity/connman/connman/CVE-2023-28488.patch | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/connman/connman/CVE-2023-28488.patch b/meta/recipes-connectivity/connman/connman/CVE-2023-28488.patch new file mode 100644 index 0000000000..ea1601cc04 --- /dev/null +++ b/meta/recipes-connectivity/connman/connman/CVE-2023-28488.patch | |||
@@ -0,0 +1,54 @@ | |||
1 | From 99e2c16ea1cced34a5dc450d76287a1c3e762138 Mon Sep 17 00:00:00 2001 | ||
2 | From: Daniel Wagner <wagi@monom.org> | ||
3 | Date: Tue, 11 Apr 2023 08:12:56 +0200 | ||
4 | Subject: gdhcp: Verify and sanitize packet length first | ||
5 | |||
6 | Upstream-Status: Backport [https://git.kernel.org/pub/scm/network/connman/connman.git/patch/?id=99e2c16ea1cced34a5dc450d76287a1c3e762138] | ||
7 | CVE: CVE-2023-28488 | ||
8 | Signed-off-by: Ashish Sharma <asharma@mvista.com> | ||
9 | |||
10 | gdhcp/client.c | 16 +++++++++------- | ||
11 | 1 file changed, 9 insertions(+), 7 deletions(-) | ||
12 | |||
13 | diff --git a/gdhcp/client.c b/gdhcp/client.c | ||
14 | index 7efa7e45..82017692 100644 | ||
15 | --- a/gdhcp/client.c | ||
16 | +++ b/gdhcp/client.c | ||
17 | @@ -1319,9 +1319,9 @@ static bool sanity_check(struct ip_udp_dhcp_packet *packet, int bytes) | ||
18 | static int dhcp_recv_l2_packet(struct dhcp_packet *dhcp_pkt, int fd, | ||
19 | struct sockaddr_in *dst_addr) | ||
20 | { | ||
21 | - int bytes; | ||
22 | struct ip_udp_dhcp_packet packet; | ||
23 | uint16_t check; | ||
24 | + int bytes, tot_len; | ||
25 | |||
26 | memset(&packet, 0, sizeof(packet)); | ||
27 | |||
28 | @@ -1329,15 +1329,17 @@ static int dhcp_recv_l2_packet(struct dhcp_packet *dhcp_pkt, int fd, | ||
29 | if (bytes < 0) | ||
30 | return -1; | ||
31 | |||
32 | - if (bytes < (int) (sizeof(packet.ip) + sizeof(packet.udp))) | ||
33 | - return -1; | ||
34 | - | ||
35 | - if (bytes < ntohs(packet.ip.tot_len)) | ||
36 | + tot_len = ntohs(packet.ip.tot_len); | ||
37 | + if (bytes > tot_len) { | ||
38 | + /* ignore any extra garbage bytes */ | ||
39 | + bytes = tot_len; | ||
40 | + } else if (bytes < tot_len) { | ||
41 | /* packet is bigger than sizeof(packet), we did partial read */ | ||
42 | return -1; | ||
43 | + } | ||
44 | |||
45 | - /* ignore any extra garbage bytes */ | ||
46 | - bytes = ntohs(packet.ip.tot_len); | ||
47 | + if (bytes < (int) (sizeof(packet.ip) + sizeof(packet.udp))) | ||
48 | + return -1; | ||
49 | |||
50 | if (!sanity_check(&packet, bytes)) | ||
51 | return -1; | ||
52 | -- | ||
53 | cgit | ||
54 | |||