]> git.proxmox.com Git - pve-qemu-kvm.git/blame - debian/patches/CVE-2015-8743-ne2000-ioport-bounds-check.patch
Two more fixes
[pve-qemu-kvm.git] / debian / patches / CVE-2015-8743-ne2000-ioport-bounds-check.patch
CommitLineData
1c771352
WB
1From ab216355b6d509dce42fda4391f61b49df2ddc93 Mon Sep 17 00:00:00 2001
2From: Prasad J Pandit <pjp@fedoraproject.org>
3Date: Thu, 31 Dec 2015 17:05:27 +0530
4Subject: [PATCH] net: ne2000: fix bounds check in ioport operations
5
6While doing ioport r/w operations, ne2000 device emulation suffers
7from OOB r/w errors. Update respective array bounds check to avoid
8OOB access.
9
10Reported-by: Ling Liu <liuling-it@360.cn>
11Cc: qemu-stable@nongnu.org
12Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
13Signed-off-by: Jason Wang <jasowang@redhat.com>
14---
15 hw/net/ne2000.c | 10 ++++++----
16 1 file changed, 6 insertions(+), 4 deletions(-)
17
18diff --git a/hw/net/ne2000.c b/hw/net/ne2000.c
19index 010f9ef..a3dffff 100644
20--- a/hw/net/ne2000.c
21+++ b/hw/net/ne2000.c
22@@ -467,8 +467,9 @@ static inline void ne2000_mem_writel(NE2000State *s, uint32_t addr,
23 uint32_t val)
24 {
25 addr &= ~1; /* XXX: check exact behaviour if not even */
26- if (addr < 32 ||
27- (addr >= NE2000_PMEM_START && addr < NE2000_MEM_SIZE)) {
28+ if (addr < 32
29+ || (addr >= NE2000_PMEM_START
30+ && addr + sizeof(uint32_t) <= NE2000_MEM_SIZE)) {
31 stl_le_p(s->mem + addr, val);
32 }
33 }
34@@ -497,8 +498,9 @@ static inline uint32_t ne2000_mem_readw(NE2000State *s, uint32_t addr)
35 static inline uint32_t ne2000_mem_readl(NE2000State *s, uint32_t addr)
36 {
37 addr &= ~1; /* XXX: check exact behaviour if not even */
38- if (addr < 32 ||
39- (addr >= NE2000_PMEM_START && addr < NE2000_MEM_SIZE)) {
40+ if (addr < 32
41+ || (addr >= NE2000_PMEM_START
42+ && addr + sizeof(uint32_t) <= NE2000_MEM_SIZE)) {
43 return ldl_le_p(s->mem + addr);
44 } else {
45 return 0xffffffff;
46--
472.1.4
48