]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Babel: Fix pointer arithmetic in subtlv parsing
authorOndrej Zajicek (work) <santiago@crfreenet.org>
Wed, 14 Jun 2017 10:34:43 +0000 (12:34 +0200)
committerOndrej Zajicek (work) <santiago@crfreenet.org>
Wed, 14 Jun 2017 10:34:43 +0000 (12:34 +0200)
The subtlv parsing code was doing byte-based arithmetic with non-void pointers,
causing it to read beyond the end of the packet.

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
proto/babel/packets.c

index 3564c703c86cba877aa117bcc51bf99c8ca7b1b0..78c133e0f97dc822698e6ba91127a1e0661c4bd9 100644 (file)
@@ -943,7 +943,7 @@ babel_read_subtlvs(struct babel_tlv *hdr,
   struct babel_tlv *tlv;
 
   for (tlv = (void *) hdr + state->current_tlv_endpos;
-       tlv < hdr + TLV_LENGTH(hdr);
+       (void *) tlv < (void *) hdr + TLV_LENGTH(hdr);
        tlv = NEXT_TLV(tlv))
   {
     /*