diff --git a/sys/include/net/gnrc/pktbuf.h b/sys/include/net/gnrc/pktbuf.h index 7453457f4bc9c08c7993f42879d6e40949733f10..af21f4a087067fb62535677f302a9cb1b34b891d 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 f8762b3001800753d8b3e54d68e9becec89a56d9..c195088739fe9e4a6232ad5c38e8f840e794a7b8 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) {