mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-25 06:23:53 +01:00
gnrc_sixlowpan_iphc: fix Out-of-bounds read
Coverty scan found this: > CID 298279 (#1 of 1): Out-of-bounds read (OVERRUN) > 21. overrun-local: Overrunning array of 16 bytes at byte offset 64 by dereferencing pointer The original intention was probably to advance the destination pointer by 4 bytes, not 4 * the destination type size.
This commit is contained in:
parent
b65c6abad5
commit
a9a0671232
@ -417,7 +417,7 @@ static size_t _iphc_ipv6_decode(const uint8_t *iphc_hdr,
|
||||
ipv6_hdr->dst.u8[1] = iphc_hdr[payload_offset++];
|
||||
ipv6_hdr->dst.u8[2] = iphc_hdr[payload_offset++];
|
||||
ipv6_hdr->dst.u8[3] = ctx->prefix_len;
|
||||
ipv6_addr_init_prefix((ipv6_addr_t *)ipv6_hdr->dst.u8 + 4,
|
||||
ipv6_addr_init_prefix((ipv6_addr_t *)(ipv6_hdr->dst.u8 + 4),
|
||||
&ctx->prefix, ctx->prefix_len);
|
||||
memcpy(ipv6_hdr->dst.u8 + 12, iphc_hdr + payload_offset + 2, 4);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user