From 1008f85715a49c6f79530a817c784b280c81bbb7 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Tue, 4 Mar 2003 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2003-03-04 --- ip/ip.h | 2 +- pc/wavelan.c | 5 +++++ port/qio.c | 8 ++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ip/ip.h b/ip/ip.h index da0583ad721023648b5d54a2e6d97186d3f7b755..7641c3638443b446126151d1b837d52e2a72a2d6 100644 --- a/ip/ip.h +++ b/ip/ip.h @@ -35,7 +35,7 @@ enum Maxproto= 20, Nhash= 64, Maxincall= 5, - Nchans= 512, + Nchans= 1024, MAClen= 16, /* longest mac address */ MAXTTL= 255, diff --git a/pc/wavelan.c b/pc/wavelan.c index 9a57b7369dc79668231e3e4d545a8cd2567695a6..65887ad85f94c26fd441974264abaaadb66e8e57 100644 --- a/pc/wavelan.c +++ b/pc/wavelan.c @@ -566,7 +566,11 @@ w_scaninfo(Ether* ether, Ctlr *ctlr, int len) for (i = 0; i < len ; i++) scanbuf[i] = csr_ins(ctlr, WR_Data1); + /* calculate number of samples */ len /= 25; + if(len == 0) + goto out; + i = ether->scan; ep = ðer->f[Ntypes]; for(fp = ether->f; fp < ep && i > 0; fp++){ @@ -589,6 +593,7 @@ w_scaninfo(Ether* ether, Ctlr *ctlr, int len) qpass(f->in, bp); i--; } +out: free(scanbuf); } diff --git a/port/qio.c b/port/qio.c index 69234d6d5449db88ca3d86b1e662151ef656b574..58ca3fe8fab26c6e4581299296268393a49e4f49 100644 --- a/port/qio.c +++ b/port/qio.c @@ -225,8 +225,12 @@ pullupblock(Block *bp, int n) nbp->rp += n; QDEBUG checkb(bp, "pullupblock 1"); return bp; - } - else { + } else { + /* shouldn't happen but why crash if it does */ + if(i < 0){ + print("pullup negative length packet\n"); + i = 0; + } memmove(bp->wp, nbp->rp, i); pullupblockcnt++; bp->wp += i;