cryptospore / rpms / qemu-kvm

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