diff options
author | Prasad J Pandit <pjp@fedoraproject.org> | 2020-11-26 19:27:06 +0530 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2020-11-27 19:35:04 +0400 |
commit | 2e1dcbc0c2af64fcb17009eaf2ceedd81be2b27f (patch) | |
tree | 842e3df9481b802bf46e8ac722abb31fb7b351b6 /src/ncsi.c | |
parent | 55e83caf7d7a49256ff38c849360d5b34aa8b546 (diff) | |
download | slirp-2e1dcbc0c2af64fcb17009eaf2ceedd81be2b27f.zip slirp-2e1dcbc0c2af64fcb17009eaf2ceedd81be2b27f.tar.gz slirp-2e1dcbc0c2af64fcb17009eaf2ceedd81be2b27f.tar.bz2 |
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.
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>
Diffstat (limited to 'src/ncsi.c')
-rw-r--r-- | src/ncsi.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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); |