mirror of
https://github.com/flatcar/scripts.git
synced 2025-12-05 09:21:43 +01:00
Merge pull request #186 from kinvolk/jepio/qemu-add-slirp
net-libs/libslirp: Import from Gentoo
This commit is contained in:
commit
77a0115be2
1
sdk_container/src/third_party/portage-stable/net-libs/libslirp/Manifest
vendored
Normal file
1
sdk_container/src/third_party/portage-stable/net-libs/libslirp/Manifest
vendored
Normal file
@ -0,0 +1 @@
|
||||
DIST libslirp-4.6.1.tar.gz 135569 BLAKE2B 7a890912f2a8ce9d6820870e2d29b9c7a2253c403c2bcb127a38e02b2b81d1e262f34571c8a4c05fbf46874b9b2967cb5597cabe169ad54f12702fdd8b90bb3c SHA512 04a9dd88cd58c849a24b9cff405d951952760d99ea2bef0b070463dff088d79f44557a13c9427ba0043f58d4b9e06b68ff64a4f23a7b0d66df594e32e1521cae
|
||||
@ -0,0 +1,48 @@
|
||||
From: Prasad J Pandit <pjp@fedoraproject.org>
|
||||
Date: Thu, 26 Nov 2020 13:57:06 +0000
|
||||
Subject: [PATCH] slirp: check pkt_len before reading protocol header
|
||||
|
||||
While processing ARP/NCSI packets in 'arp_input' or 'ncsi_input'
|
||||
routines, ensure that pkt_len is large enough to accommodate the
|
||||
respective protocol headers, lest it should do an OOB access.
|
||||
Add check to avoid it.
|
||||
|
||||
Reported-by: Qiuhao Li @outlook.com;
|
||||
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
|
||||
---
|
||||
src/ncsi.c | 4 ++++
|
||||
src/slirp.c | 4 ++++
|
||||
2 files changed, 8 insertions(+)
|
||||
|
||||
diff --git a/src/ncsi.c b/src/ncsi.c
|
||||
index 3c1dfef..75dcc08 100644
|
||||
--- a/src/ncsi.c
|
||||
+++ b/src/ncsi.c
|
||||
@@ -148,6 +148,10 @@ void ncsi_input(Slirp *slirp, const uint8_t *pkt, int pkt_len)
|
||||
uint32_t checksum;
|
||||
uint32_t *pchecksum;
|
||||
|
||||
+ if (pkt_len < ETH_HLEN + sizeof(struct ncsi_pkt_hdr)) {
|
||||
+ return; /* packet too short */
|
||||
+ }
|
||||
+
|
||||
memset(ncsi_reply, 0, sizeof(ncsi_reply));
|
||||
|
||||
memset(reh->h_dest, 0xff, ETH_ALEN);
|
||||
diff --git a/src/slirp.c b/src/slirp.c
|
||||
index 9bead0c..abb6f9a 100644
|
||||
--- a/src/slirp.c
|
||||
+++ b/src/slirp.c
|
||||
@@ -860,6 +860,10 @@ static void arp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len)
|
||||
return;
|
||||
}
|
||||
|
||||
+ if (pkt_len < ETH_HLEN + sizeof(struct slirp_arphdr)) {
|
||||
+ return; /* packet too short */
|
||||
+ }
|
||||
+
|
||||
ar_op = ntohs(ah->ar_op);
|
||||
switch (ar_op) {
|
||||
case ARPOP_REQUEST:
|
||||
--
|
||||
2.28.0
|
||||
35
sdk_container/src/third_party/portage-stable/net-libs/libslirp/libslirp-4.6.1.ebuild
vendored
Normal file
35
sdk_container/src/third_party/portage-stable/net-libs/libslirp/libslirp-4.6.1.ebuild
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
# Copyright 1999-2021 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=7
|
||||
|
||||
inherit meson
|
||||
|
||||
KEYWORDS="amd64 arm64 ~ppc ppc64 x86"
|
||||
MY_P="${PN}-v${PV}"
|
||||
SRC_URI="https://gitlab.freedesktop.org/slirp/libslirp/-/archive/v${PV}/${MY_P}.tar.gz -> ${P}.tar.gz"
|
||||
DESCRIPTION="A TCP-IP emulator used to provide virtual networking services."
|
||||
HOMEPAGE="https://gitlab.freedesktop.org/slirp/libslirp"
|
||||
|
||||
LICENSE="BSD"
|
||||
SLOT="0"
|
||||
IUSE="static-libs"
|
||||
|
||||
RDEPEND="dev-libs/glib:="
|
||||
|
||||
DEPEND="${RDEPEND}"
|
||||
|
||||
S=${WORKDIR}/${MY_P}
|
||||
|
||||
src_prepare() {
|
||||
echo "${PV}" > .tarball-version || die
|
||||
echo -e "#!${BASH}\necho -n \$(cat '${S}/.tarball-version')" > build-aux/git-version-gen || die
|
||||
default
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
local emesonargs=(
|
||||
-Ddefault_library=$(usex static-libs both shared)
|
||||
)
|
||||
meson_src_configure
|
||||
}
|
||||
11
sdk_container/src/third_party/portage-stable/net-libs/libslirp/metadata.xml
vendored
Normal file
11
sdk_container/src/third_party/portage-stable/net-libs/libslirp/metadata.xml
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<maintainer type="person">
|
||||
<name>Zac Medico</name>
|
||||
<email>zmedico@gentoo.org</email>
|
||||
</maintainer>
|
||||
<upstream>
|
||||
<remote-id type="gitlab">gitlab.freedesktop.org/slirp/libslirp</remote-id>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
||||
Loading…
x
Reference in New Issue
Block a user