summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/src/9/ip/ethermedium.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/src/9/ip/ethermedium.c b/sys/src/9/ip/ethermedium.c
index 1aab2b9ec..f5b4e855d 100644
--- a/sys/src/9/ip/ethermedium.c
+++ b/sys/src/9/ip/ethermedium.c
@@ -354,11 +354,12 @@ etherread4(void *a)
nexterror();
}
ifc->in++;
- bp->rp += ifc->m->hsize;
- if(ifc->lifc == nil)
+ if(ifc->lifc == nil || BLEN(bp) <= ifc->m->hsize)
freeb(bp);
- else
+ else {
+ bp->rp += ifc->m->hsize;
ipiput4(er->f, ifc, bp);
+ }
runlock(ifc);
poperror();
}
@@ -393,11 +394,12 @@ etherread6(void *a)
nexterror();
}
ifc->in++;
- bp->rp += ifc->m->hsize;
- if(ifc->lifc == nil)
+ if(ifc->lifc == nil || BLEN(bp) <= ifc->m->hsize)
freeb(bp);
- else
+ else {
+ bp->rp += ifc->m->hsize;
ipiput6(er->f, ifc, bp);
+ }
runlock(ifc);
poperror();
}