From 85fe445db802f6acfacab245527103243ad4fdd4 Mon Sep 17 00:00:00 2001
From: Oleg Hahm <oleg@hobbykeller.org>
Date: Tue, 18 Aug 2015 14:19:23 +0200
Subject: [PATCH] pktbuf: assert for potential null pointer

In practice, this should not happen, since `_first_unused` should be
already set, if `_too_small_hole()` returns true.
---
 sys/net/crosslayer/ng_pktbuf_static/ng_pktbuf_static.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/net/crosslayer/ng_pktbuf_static/ng_pktbuf_static.c b/sys/net/crosslayer/ng_pktbuf_static/ng_pktbuf_static.c
index 69cc65d5b5..58336ab120 100644
--- a/sys/net/crosslayer/ng_pktbuf_static/ng_pktbuf_static.c
+++ b/sys/net/crosslayer/ng_pktbuf_static/ng_pktbuf_static.c
@@ -429,6 +429,8 @@ static inline bool _too_small_hole(_unused_t *a, _unused_t *b)
 
 static inline _unused_t *_merge(_unused_t *a, _unused_t *b)
 {
+    assert(b != NULL);
+
     a->next = b->next;
     a->size = b->size + ((uint8_t *)b - (uint8_t *)a);
     return a;
-- 
GitLab