Blame SOURCES/0005-tftp-check-tftp_input-buffer-size.patch
|
|
ab660b |
From 31aaf902aa6ba31ab8f41543b2d4da8c01f3b861 Mon Sep 17 00:00:00 2001
|
|
|
ab660b |
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
|
|
|
ab660b |
Date: Fri, 4 Jun 2021 16:34:30 +0400
|
|
|
ab660b |
Subject: [PATCH 5/7] tftp: check tftp_input buffer size
|
|
|
ab660b |
MIME-Version: 1.0
|
|
|
ab660b |
Content-Type: text/plain; charset=UTF-8
|
|
|
ab660b |
Content-Transfer-Encoding: 8bit
|
|
|
ab660b |
|
|
|
ab660b |
Fixes: CVE-2021-3595
|
|
|
ab660b |
Fixes: https://gitlab.freedesktop.org/slirp/libslirp/-/issues/46
|
|
|
ab660b |
|
|
|
ab660b |
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
ab660b |
(cherry picked from commit 3f17948137155f025f7809fdc38576d5d2451c3d)
|
|
|
ab660b |
---
|
|
|
ab660b |
src/tftp.c | 6 +++++-
|
|
|
ab660b |
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
|
ab660b |
|
|
|
ab660b |
diff --git a/src/tftp.c b/src/tftp.c
|
|
|
ab660b |
index c6950ee..e06911d 100644
|
|
|
ab660b |
--- a/src/tftp.c
|
|
|
ab660b |
+++ b/src/tftp.c
|
|
|
ab660b |
@@ -446,7 +446,11 @@ static void tftp_handle_error(Slirp *slirp, struct sockaddr_storage *srcsas,
|
|
|
ab660b |
|
|
|
ab660b |
void tftp_input(struct sockaddr_storage *srcsas, struct mbuf *m)
|
|
|
ab660b |
{
|
|
|
ab660b |
- struct tftp_t *tp = (struct tftp_t *)m->m_data;
|
|
|
ab660b |
+ struct tftp_t *tp = mtod_check(m, offsetof(struct tftp_t, x.tp_buf));
|
|
|
ab660b |
+
|
|
|
ab660b |
+ if (tp == NULL) {
|
|
|
ab660b |
+ return;
|
|
|
ab660b |
+ }
|
|
|
ab660b |
|
|
|
ab660b |
switch (ntohs(tp->tp_op)) {
|
|
|
ab660b |
case TFTP_RRQ:
|
|
|
ab660b |
--
|
|
|
ab660b |
2.29.0
|
|
|
ab660b |
|