diff options
author | Sander Vrijders <sander.vrijders@ugent.be> | 2017-03-24 10:59:15 +0100 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@ugent.be> | 2017-03-24 10:59:15 +0100 |
commit | a02044a3b9a44e24699311ed753491ebca472c62 (patch) | |
tree | 01c94a6c09963c4a8fcf160ba32e046a144d6de3 /src/ipcpd | |
parent | 6688251a7a18f267535c5369c1e856d2c2c1605e (diff) | |
download | ouroboros-a02044a3b9a44e24699311ed753491ebca472c62.tar.gz ouroboros-a02044a3b9a44e24699311ed753491ebca472c62.zip |
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.
Diffstat (limited to 'src/ipcpd')
-rw-r--r-- | src/ipcpd/normal/graph.c | 3 |
1 files changed, 2 insertions, 1 deletions
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; } |