Explorar o código

Return the actual number of hops in cpath_get_n_hops()

Bug not in any version of tor.

Found with clang's scan-build.
Nick Mathewson %!s(int64=6) %!d(string=hai) anos
pai
achega
db00f24d8b
Modificáronse 1 ficheiros con 3 adicións e 3 borrados
  1. 3 3
      src/or/circuitbuild.c

+ 3 - 3
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;
 }