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

gnrc_sixlowpan_iphc: check ptr != NULL in compressible check

Not only does this leave open a risk to crash the node for the check
in `_compressible()` but also is the `tmp` check below getting confused
when `ptr` is `NULL`, since `gnrc_pktbuf_start_write()` returns `NULL`
in that case.
This commit is contained in:
Martine Lenders 2019-03-12 16:01:26 +01:00
parent b50ad9ed4c
commit 3582dedd4e

View File

@ -673,7 +673,7 @@ void gnrc_sixlowpan_iphc_send(gnrc_pktsnip_t *pkt, void *ctx, unsigned page)
dispatch = NULL; /* use dispatch as temporary pointer for prev */
/* determine maximum dispatch size and write protect all headers until
* then because they will be removed */
while (_compressible(ptr)) {
while ((ptr != NULL) && _compressible(ptr)) {
gnrc_pktsnip_t *tmp = gnrc_pktbuf_start_write(ptr);
if (tmp == NULL) {