summaryrefslogtreecommitdiff
path: root/src/ipcpd
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@ugent.be>2018-05-28 15:55:13 +0200
committerSander Vrijders <sander.vrijders@ugent.be>2018-05-28 15:59:09 +0200
commit7171512cd4f31b3c2dc5c135bd48e278ea2e2d0d (patch)
treee14f24658b8349485fbc4207b6addf81d744fae3 /src/ipcpd
parent1bee8b3d288bc2c26432b8e675b18e482a98255e (diff)
downloadouroboros-7171512cd4f31b3c2dc5c135bd48e278ea2e2d0d.tar.gz
ouroboros-7171512cd4f31b3c2dc5c135bd48e278ea2e2d0d.zip
ipcpd: Avoid false positive use-after-free in DHT
The static analyzer misses the linked list logic. An assertion is added that indicates that the pointer was changed indirectly by the previous element. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
Diffstat (limited to 'src/ipcpd')
-rw-r--r--src/ipcpd/normal/dht.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/ipcpd/normal/dht.c b/src/ipcpd/normal/dht.c
index 917cbc15..069b89d5 100644
--- a/src/ipcpd/normal/dht.c
+++ b/src/ipcpd/normal/dht.c
@@ -863,6 +863,7 @@ static void lookup_update(struct dht * dht,
d = list_last_entry(&lu->contacts,
struct contact, next);
list_del(&d->next);
+ assert(lu->contacts.prv != &d->next);
contact_destroy(d);
mod = true;
}