From: liucheng (G) Date: Thu, 29 Aug 2019 13:47:33 +0000 (+0000) Subject: CVE: net: fix unbounded memcpy of UDP packet X-Git-Tag: v2025.01-rc5-pxa1908~2800^2~7 X-Git-Url: http://git.dujemihanovic.xyz/img/%7B%7B?a=commitdiff_plain;h=fe7288069d2e6659117049f7d27e261b550bb725;p=u-boot.git CVE: net: fix unbounded memcpy of UDP packet This patch adds a check to udp_len to fix unbounded memcpy for CVE-2019-14192, CVE-2019-14193 and CVE-2019-14199. Signed-off-by: Cheng Liu Reviewed-by: Simon Goldschmidt Reported-by: Fermín Serna Acked-by: Joe Hershberger --- diff --git a/net/net.c b/net/net.c index 74a8a36b5a..ded86e7456 100644 --- a/net/net.c +++ b/net/net.c @@ -1264,6 +1264,9 @@ void net_process_received_packet(uchar *in_packet, int len) return; } + if (ntohs(ip->udp_len) < UDP_HDR_SIZE || ntohs(ip->udp_len) > ntohs(ip->ip_len)) + return; + debug_cond(DEBUG_DEV_PKT, "received UDP (to=%pI4, from=%pI4, len=%d)\n", &dst_ip, &src_ip, len);