From 52f3a565deca246e0a331f4a014178c3f6927f31 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Thu, 10 Nov 2016 02:51:54 +0100 Subject: libcnary: Fix possible NULL pointer dereference in node_iterator_create() When NULL is passed to node_iterator_create() the code tries to access the begin element of the node list and causes a NULL pointer dereference. The value of list is checked a few lines down and iterator->value is then properly assigned in node_iterator_bind(). --- libcnary/node_iterator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcnary/node_iterator.c b/libcnary/node_iterator.c index dedf3b4..e629b73 100644 --- a/libcnary/node_iterator.c +++ b/libcnary/node_iterator.c @@ -47,7 +47,7 @@ node_iterator_t* node_iterator_create(node_list_t* list) { iterator->end = NULL; iterator->begin = NULL; - iterator->value = list->begin; + iterator->value = NULL; iterator->list = NULL; iterator->next = node_iterator_next; -- cgit v1.1-32-gdbae