cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
6e7d01
From a66ab346bf74ebf3ed8fca0dc2e2febfe70069e8 Mon Sep 17 00:00:00 2001
6e7d01
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
6e7d01
Date: Thu, 29 Jul 2021 04:56:28 -0400
6e7d01
Subject: [PATCH 07/14] bootp: check bootp_input buffer size
6e7d01
MIME-Version: 1.0
6e7d01
Content-Type: text/plain; charset=UTF-8
6e7d01
Content-Transfer-Encoding: 8bit
6e7d01
6e7d01
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
6e7d01
Message-id: <20210708082537.1550263-4-marcandre.lureau@redhat.com>
6e7d01
Patchwork-id: 101820
6e7d01
O-Subject: [RHEL-8.5.0 qemu-kvm PATCH 3/8] bootp: check bootp_input buffer size
6e7d01
Bugzilla: 1970819
6e7d01
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
6e7d01
RH-Acked-by: Eric Blake <eblake@redhat.com>
6e7d01
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
6e7d01
6e7d01
From: Marc-André Lureau <marcandre.lureau@redhat.com>
6e7d01
6e7d01
Fixes: CVE-2021-3592
6e7d01
Fixes: https://gitlab.freedesktop.org/slirp/libslirp/-/issues/44
6e7d01
6e7d01
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
6e7d01
6e7d01
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1970819
6e7d01
6e7d01
(cherry picked from commit 2eca0838eee1da96204545e22cdaed860d9d7c6c)
6e7d01
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
6e7d01
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
6e7d01
---
6e7d01
 slirp/src/bootp.c | 4 ++--
6e7d01
 1 file changed, 2 insertions(+), 2 deletions(-)
6e7d01
6e7d01
diff --git a/slirp/src/bootp.c b/slirp/src/bootp.c
6e7d01
index 5754327138..5789187166 100644
6e7d01
--- a/slirp/src/bootp.c
6e7d01
+++ b/slirp/src/bootp.c
6e7d01
@@ -366,9 +366,9 @@ udp_output(NULL, m, &saddr, &daddr, IPTOS_LOWDELAY);
6e7d01
 
6e7d01
 void bootp_input(struct mbuf *m)
6e7d01
 {
6e7d01
-    struct bootp_t *bp = mtod(m, struct bootp_t *);
6e7d01
+    struct bootp_t *bp = mtod_check(m, sizeof(struct bootp_t));
6e7d01
 
6e7d01
-    if (bp->bp_op == BOOTP_REQUEST) {
6e7d01
+    if (bp && bp->bp_op == BOOTP_REQUEST) {
6e7d01
         bootp_reply(m->slirp, bp, m_end(m));
6e7d01
     }
6e7d01
 }
6e7d01
-- 
6e7d01
2.27.0
6e7d01