Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:FrontRunner
qemu-testsuite.19805
0230-slirp-check-pkt_len-before-reading-.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0230-slirp-check-pkt_len-before-reading-.patch of Package qemu-testsuite.19805
From: Prasad J Pandit <pjp@fedoraproject.org> Date: Thu, 26 Nov 2020 19:27:06 +0530 Subject: slirp: check pkt_len before reading protocol header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Git-commit: 2e1dcbc0c2af64fcb17009eaf2ceedd81be2b27f References: bsc#1179466, bsc#1179467 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. CVE-2020-29129 CVE-2020-29130 QEMU: slirp: out-of-bounds access while processing ARP/NCSI packets -> https://www.openwall.com/lists/oss-security/2020/11/27/1 Reported-by: Qiuhao Li <Qiuhao.Li@outlook.com> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> Message-Id: <20201126135706.273950-1-ppandit@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Bruce Rogers <brogers@suse.com> --- slirp/ncsi.c | 4 ++++ slirp/slirp.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/slirp/ncsi.c b/slirp/ncsi.c index d12ba3e494b07c35af02e8e2ea4f..be3c9fb2668766443374615c56c8 100644 --- a/slirp/ncsi.c +++ b/slirp/ncsi.c @@ -88,6 +88,10 @@ void ncsi_input(Slirp *slirp, const uint8_t *pkt, int pkt_len) const struct ncsi_rsp_handler *handler = NULL; int i; + 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/slirp/slirp.c b/slirp/slirp.c index 1cb6b07004b01424501de112eb11..8e1b1678f33f85b59eeb2430f6df 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -789,6 +789,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:
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor