diff --git a/sys/include/net/gnrc/pktbuf.h b/sys/include/net/gnrc/pktbuf.h index 7453457f4b..af21f4a087 100644 --- a/sys/include/net/gnrc/pktbuf.h +++ b/sys/include/net/gnrc/pktbuf.h @@ -191,6 +191,8 @@ gnrc_pktsnip_t *gnrc_pktbuf_start_write(gnrc_pktsnip_t *pkt); /** * @brief Create a IOVEC representation of the packet pointed to by *pkt* * + * @pre `(len != NULL)` + * * @details This function will create a new packet snip in the packet buffer, * which points to the given *pkt* and contains a IOVEC representation * of the referenced packet in its data section. diff --git a/sys/net/gnrc/pktbuf_static/gnrc_pktbuf_static.c b/sys/net/gnrc/pktbuf_static/gnrc_pktbuf_static.c index f8762b3001..c195088739 100644 --- a/sys/net/gnrc/pktbuf_static/gnrc_pktbuf_static.c +++ b/sys/net/gnrc/pktbuf_static/gnrc_pktbuf_static.c @@ -276,6 +276,7 @@ gnrc_pktsnip_t *gnrc_pktbuf_get_iovec(gnrc_pktsnip_t *pkt, size_t *len) gnrc_pktsnip_t *head; struct iovec *vec; + assert(len != NULL); if (pkt == NULL) { *len = 0; return NULL; @@ -289,6 +290,8 @@ gnrc_pktsnip_t *gnrc_pktbuf_get_iovec(gnrc_pktsnip_t *pkt, size_t *len) *len = 0; return NULL; } + + assert(head->data != NULL); vec = (struct iovec *)(head->data); /* fill the IOVEC */ while (pkt != NULL) {