]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
don't let recently_chosen_ntors overflow
authorRoger Dingledine <arma@torproject.org>
Thu, 5 Sep 2013 05:27:46 +0000 (01:27 -0400)
committerRoger Dingledine <arma@torproject.org>
Thu, 5 Sep 2013 05:27:46 +0000 (01:27 -0400)
with commit c6f1668d we let it grow arbitrarily large.

it can still overflow, but the damage is very small now.

src/or/onion.c

index 41fe7b6eea8e7b0f9dee20ee9594bc00b5ea56b6..8e3e487ce0d743ead356f361c61125eaf0296410 100644 (file)
@@ -212,7 +212,7 @@ static uint16_t
 decide_next_handshake_type(void)
 {
   /* The number of times we've chosen ntor lately when both were available. */
-  static int recently_chosen_ntors = 0;
+  static unsigned int recently_chosen_ntors = 0;
 
   if (!ol_entries[ONION_HANDSHAKE_TYPE_NTOR])
     return ONION_HANDSHAKE_TYPE_TAP; /* no ntors? try tap */