blob: a19545a2d3ff36d614187d35ff117b7d30aeb4ea [file] [log] [blame]
Brad Bishop00e122a2019-10-05 11:10:57 -04001From e8e602f4a4b2aacfb3da32bb8a838be15ea70e7b Mon Sep 17 00:00:00 2001
2From: "liucheng (G)" <liucheng32@huawei.com>
3Date: Thu, 29 Aug 2019 13:47:33 +0000
4Subject: [PATCH 5/9] CVE: net: fix unbounded memcpy of UDP packet
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9This patch adds a check to udp_len to fix unbounded memcpy for
10CVE-2019-14192, CVE-2019-14193 and CVE-2019-14199.
11
12Signed-off-by: Cheng Liu <liucheng32@huawei.com>
13Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
14Reported-by: Fermín Serna <fermin@semmle.com>
15Acked-by: Joe Hershberger <joe.hershberger@ni.com>
16
17Upstream-Status: Backport[http://git.denx.de/?p=u-boot.git;a=commit;
18 h=fe7288069d2e6659117049f7d27e261b550bb725]
19
20CVE: CVE-2019-14192, CVE-2019-14193 and CVE-2019-14199
21
22Signed-off-by: Meng Li <Meng.Li@windriver.com>
23---
24 net/net.c | 3 +++
25 1 file changed, 3 insertions(+)
26
27diff --git a/net/net.c b/net/net.c
28index 58b0417cbe..38105f1142 100644
29--- a/net/net.c
30+++ b/net/net.c
31@@ -1252,6 +1252,9 @@ void net_process_received_packet(uchar *in_packet, int len)
32 return;
33 }
34
35+ if (ntohs(ip->udp_len) < UDP_HDR_SIZE || ntohs(ip->udp_len) > ntohs(ip->ip_len))
36+ return;
37+
38 debug_cond(DEBUG_DEV_PKT,
39 "received UDP (to=%pI4, from=%pI4, len=%d)\n",
40 &dst_ip, &src_ip, len);
41--
422.17.1
43