yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
42c570
From 4186ab1a803003e68d721fbb0095fa62cf671c4a Mon Sep 17 00:00:00 2001
42c570
From: Jon Maloy <jmaloy@redhat.com>
42c570
Date: Mon, 17 Aug 2020 21:06:08 +0000
42c570
Subject: [PATCH] Drop bogus IPv6 messages
42c570
MIME-Version: 1.0
42c570
Content-Type: text/plain; charset=UTF-8
42c570
Content-Transfer-Encoding: 8bit
42c570
42c570
Drop bogus IPv6 messages
42c570
42c570
RH-Author: Jon Maloy <jmaloy@redhat.com>
42c570
Message-id: <20200817220608.1142611-2-jmaloy@redhat.com>
42c570
Patchwork-id: 98161
42c570
O-Subject: [RHEL-AV-8.3.0 qemu-kvm PATCH 1/1] Drop bogus IPv6 messages
42c570
Bugzilla: 1838092 1867075 1870421
42c570
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
42c570
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
42c570
RH-Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
42c570
42c570
From: Ralf Haferkamp <rhafer@suse.com>
42c570
42c570
Drop IPv6 message shorter than what's mentioned in the payload
42c570
length header (+ the size of the IPv6 header). They're invalid an could
42c570
lead to data leakage in icmp6_send_echoreply().
42c570
42c570
(cherry picked from libslirp commit c7ede54cbd2e2b25385325600958ba0124e31cc0)
42c570
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
42c570
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
42c570
---
42c570
 slirp/ip6_input.c | 7 +++++++
42c570
 1 file changed, 7 insertions(+)
42c570
42c570
diff --git a/slirp/ip6_input.c b/slirp/ip6_input.c
42c570
index ac2e3ea882..deb3d6e086 100644
42c570
--- a/slirp/ip6_input.c
42c570
+++ b/slirp/ip6_input.c
42c570
@@ -49,6 +49,13 @@ void ip6_input(struct mbuf *m)
42c570
         goto bad;
42c570
     }
42c570
 
42c570
+    // Check if the message size is big enough to hold what's
42c570
+    // set in the payload length header. If not this is an invalid
42c570
+    // packet
42c570
+    if (m->m_len < ntohs(ip6->ip_pl) + sizeof(struct ip6)) {
42c570
+        goto bad;
42c570
+    }
42c570
+
42c570
     /* check ip_ttl for a correct ICMP reply */
42c570
     if (ip6->ip_hl == 0) {
42c570
         icmp6_send_error(m, ICMP6_TIMXCEED, ICMP6_TIMXCEED_INTRANS);
42c570
-- 
42c570
2.27.0
42c570