1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

gnrc_sixlowpan_iphc: assure ctx != NULL for dst compression

For the source address compression it was already done the same way in
12bcc46f15
This commit is contained in:
Martine Lenders 2018-11-08 15:22:44 +01:00 committed by Martine S. Lenders
parent 2cb0ccc800
commit 3ee75c3ca9

View File

@ -454,6 +454,7 @@ void gnrc_sixlowpan_iphc_recv(gnrc_pktsnip_t *sixlo, void *rbuf_ptr,
break;
case IPHC_M_DAC_DAM_U_CTX_64:
assert(ctx != NULL);
memcpy(ipv6_hdr->dst.u8 + 8, iphc_hdr + payload_offset, 8);
ipv6_addr_init_prefix(&ipv6_hdr->dst, &ctx->prefix,
ctx->prefix_len);
@ -464,6 +465,7 @@ void gnrc_sixlowpan_iphc_recv(gnrc_pktsnip_t *sixlo, void *rbuf_ptr,
ipv6_hdr->dst.u32[2] = byteorder_htonl(0x000000ff);
ipv6_hdr->dst.u16[6] = byteorder_htons(0xfe00);
memcpy(ipv6_hdr->dst.u8 + 14, iphc_hdr + payload_offset, 2);
assert(ctx != NULL);
ipv6_addr_init_prefix(&ipv6_hdr->dst, &ctx->prefix,
ctx->prefix_len);
payload_offset += 2;
@ -477,6 +479,7 @@ void gnrc_sixlowpan_iphc_recv(gnrc_pktsnip_t *sixlo, void *rbuf_ptr,
_recv_error_release(sixlo, ipv6, rbuf);
return;
}
assert(ctx != NULL);
ipv6_addr_init_prefix(&ipv6_hdr->dst, &ctx->prefix,
ctx->prefix_len);
break;
@ -509,6 +512,7 @@ void gnrc_sixlowpan_iphc_recv(gnrc_pktsnip_t *sixlo, void *rbuf_ptr,
case IPHC_M_DAC_DAM_M_UC_PREFIX:
do {
assert(ctx != NULL);
uint8_t orig_ctx_len = ctx->prefix_len;
ipv6_addr_set_unspecified(&ipv6_hdr->dst);