summaryrefslogtreecommitdiff
path: root/sys/src/9/ip
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2016-11-08 22:33:19 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2016-11-08 22:33:19 +0100
commitba38aa8b9d6456d4d281a01a7565d59d546a4638 (patch)
treea24551c71941f749f099414cb43576f0c33f4d33 /sys/src/9/ip
parent58fe71b2f56fade7db49069c123c97a69f53ac02 (diff)
gre: check nil for pullupblock()
Diffstat (limited to 'sys/src/9/ip')
-rw-r--r--sys/src/9/ip/gre.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/src/9/ip/gre.c b/sys/src/9/ip/gre.c
index 31b384bd5..df22c087a 100644
--- a/sys/src/9/ip/gre.c
+++ b/sys/src/9/ip/gre.c
@@ -300,6 +300,8 @@ grekick(void *x, Block *bp)
/* make sure the message has a GRE header */
bp = pullupblock(bp, GRE_IPONLY+GRE_IPPLUSGRE);
+ if(bp == nil)
+ return;
gre = (GREhdr *)bp->rp;
gre->vihl = IP_VER4;
@@ -528,11 +530,8 @@ greiput(Proto *proto, Ipifc *, Block *bp)
* that when the block is forwarded, devether.c puts the block into
* a queue that also uses ->next. Just do not use ->next here!
*/
- if(bp->next){
- len = blocklen(bp);
- bp = pullupblock(bp, len);
- assert(BLEN(bp) == len && bp->next == nil);
- }
+ if(bp->next != nil)
+ bp = pullupblock(bp, blocklen(bp));
gre = (GREhdr *)bp->rp;
if(BLEN(bp) < sizeof(GREhdr) || gre->proto != IP_GREPROTO){