From: Marc-André Lureau Date: Fri, 4 Jun 2021 12:40:23 +0000 (+0400) Subject: udp: check upd_input buffer size X-Git-Tag: upstream/4.2.1~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a672b5745e13c54e22cbb7ec47809ef8e1d93aec;p=tools%2Fqemu-arm-static.git udp: check upd_input buffer size Git-commit: 74572be49247c8c5feae7c6e0b50c4f569ca9824 References: bsc#1187367, CVE-2021-3594 Fixes: CVE-2021-3594 Fixes: https://gitlab.freedesktop.org/slirp/libslirp/-/issues/47 Signed-off-by: Marc-André Lureau Signed-off-by: Jose R Ziviani --- diff --git a/slirp/src/udp.c b/slirp/src/udp.c index 6bde20faf..c2d2f40b1 100644 --- a/slirp/src/udp.c +++ b/slirp/src/udp.c @@ -90,7 +90,10 @@ void udp_input(register struct mbuf *m, int iphlen) /* * Get IP and UDP header together in first mbuf. */ - ip = mtod(m, struct ip *); + ip = mtod_check(m, iphlen + sizeof(struct udphdr)); + if (ip == NULL) { + goto bad; + } uh = (struct udphdr *)((char *)ip + iphlen); /*