From 4687e196cc6afa63754f8928154dc3bbf276dda5 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Wed, 25 Mar 2015 03:03:24 +0100 Subject: zynq: fix out of bounds access in etherprobe() calling etherprobe() with -1 cardno will rereference and call cards[-1].reset() which is wrong. don't do that! --- sys/src/9/zynq/devether.c | 6 ------ sys/src/9/zynq/etherif.h | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/sys/src/9/zynq/devether.c b/sys/src/9/zynq/devether.c index c6ed2eac3..90777e6f5 100644 --- a/sys/src/9/zynq/devether.c +++ b/sys/src/9/zynq/devether.c @@ -435,12 +435,6 @@ etherreset(void) Ether *ether; int cardno, ctlrno; - for(ctlrno = 0; ctlrno < MaxEther; ctlrno++){ - if((ether = etherprobe(-1, ctlrno)) == nil) - continue; - etherxx[ctlrno] = ether; - } - cardno = ctlrno = 0; while(cards[cardno].type != nil && ctlrno < MaxEther){ if(etherxx[ctlrno] != nil){ diff --git a/sys/src/9/zynq/etherif.h b/sys/src/9/zynq/etherif.h index d7ea87523..80a39aa8b 100644 --- a/sys/src/9/zynq/etherif.h +++ b/sys/src/9/zynq/etherif.h @@ -1,5 +1,5 @@ enum { - MaxEther = 64, + MaxEther = 1, Ntypes = 8, }; -- cgit v1.2.3