summaryrefslogtreecommitdiff
path: root/src/or/circuitbuild.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-09-12 17:55:33 -0400
committerNick Mathewson <nickm@torproject.org>2017-09-12 19:03:04 -0400
commitdb00f24d8be848f5840af913e88d5ae7019c70f6 (patch)
treea7c2aa17d602cc759f058032f28d07b4178f1792 /src/or/circuitbuild.c
parenta4847ffa915ec7d09ae28ef4ad6bc1c8a1b324ca (diff)
downloadtor-db00f24d8be848f5840af913e88d5ae7019c70f6.tar.gz
tor-db00f24d8be848f5840af913e88d5ae7019c70f6.zip
Return the actual number of hops in cpath_get_n_hops()
Bug not in any version of tor. Found with clang's scan-build.
Diffstat (limited to 'src/or/circuitbuild.c')
-rw-r--r--src/or/circuitbuild.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 279308afcb..e796ea2ed3 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -2422,10 +2422,10 @@ cpath_get_n_hops(crypt_path_t **head_ptr)
}
tmp = *head_ptr;
- if (tmp) {
+ do {
n_hops++;
- tmp = (*head_ptr)->next;
- }
+ tmp = tmp->next;
+ } while (tmp != *head_ptr);
return n_hops;
}