Skip to content

Commit

Permalink
IPv6: allow complete in ipv6_addr_init_prefix
Browse files Browse the repository at this point in the history
If the specified prefix is a full IPv6 address, no bits remain.
Fixes a possible buffer overrun.
  • Loading branch information
OlegHahm committed Nov 10, 2014
1 parent b96b995 commit 365bfd8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sys/net/network_layer/sixlowpan/ip.c
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,9 @@ void ipv6_addr_init_prefix(ipv6_addr_t *out, const ipv6_addr_t *prefix,
}

memcpy(out, prefix, bytes);
out->uint8[bytes] = prefix->uint8[bytes] & mask;
if (bytes < 16) {
out->uint8[bytes] = prefix->uint8[bytes] & mask;
}
memset(&(out[bytes + 1]), 0, 15 - bytes);
}

Expand Down

0 comments on commit 365bfd8

Please sign in to comment.