Skip to content

Commit

Permalink
ospf6d: fix out of bounds write in ospf6_prefix_apply_mask
Browse files Browse the repository at this point in the history
ospf6_prefix_apply_mask would write one byte beyond the 4/8/12
bytes allocated for prefixes of length 32/64/96.

based on report and patch by Jon Andersson <[email protected]>

Reported-by: Jon Andersson <[email protected]>
Signed-off-by: David Lamparter <[email protected]>
  • Loading branch information
eqvinox committed Feb 11, 2012
1 parent 4afa50b commit 4c0cf00
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ospf6d/ospf6_proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ ospf6_prefix_apply_mask (struct ospf6_prefix *op)
return;
}

if (index == 16)
return;

pnt[index] &= mask;
index ++;
/* nonzero mask means no check for this byte because if it contains
* prefix bits it must be there for us to write */
if (mask)
pnt[index++] &= mask;

while (index < OSPF6_PREFIX_SPACE (op->prefix_length))
pnt[index++] = 0;
Expand Down

0 comments on commit 4c0cf00

Please sign in to comment.