[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Return the actual number of hops in cpath_get_n_hops()
commit db00f24d8be848f5840af913e88d5ae7019c70f6
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Tue Sep 12 17:55:33 2017 -0400
Return the actual number of hops in cpath_get_n_hops()
Bug not in any version of tor.
Found with clang's scan-build.
---
src/or/circuitbuild.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 279308afc..e796ea2ed 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;
}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits