From a02044a3b9a44e24699311ed753491ebca472c62 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Fri, 24 Mar 2017 10:59:15 +0100 Subject: ipcpd: normal: Fix segfault in dijkstra calculation This fixes a dumb segfault in the dijkstra calculation. If an entry can be removed from the table it was set to NULL. However, if the table is completely empty, the index was -1, resulting in an illegal access into the table. --- src/ipcpd/normal/graph.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ipcpd/normal/graph.c b/src/ipcpd/normal/graph.c index 2ae36918..ed545b8c 100644 --- a/src/ipcpd/normal/graph.c +++ b/src/ipcpd/normal/graph.c @@ -340,7 +340,8 @@ static int get_min_vertex(struct vertex ** vertices, } } - vertices[index] = NULL; + if (index != -1) + vertices[index] = NULL; return index; } -- cgit v1.2.3