[tor-commits] [tor/master] Add a check and a cast in rephist.c to fix a warning

nickm at torproject.org nickm at torproject.org
Tue May 9 15:13:28 UTC 2017


commit 9f5b71a7cafbaf1468ec9cb72b8061343c1fae98
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue May 9 11:13:22 2017 -0400

    Add a check and a cast in rephist.c to fix a warning
---
 src/or/rephist.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/or/rephist.c b/src/or/rephist.c
index 96087f9..72a5cc5 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -1828,7 +1828,11 @@ predicted_ports_prediction_time_remaining(time_t now)
   if (idle_delta > prediction_timeout)
     return 0;
 
-  return prediction_timeout - idle_delta;
+  if (BUG((prediction_timeout - idle_delta) > INT_MAX)) {
+    return INT_MAX;
+  }
+
+  return (int)(prediction_timeout - idle_delta);
 }
 
 /** We just got an application request for a connection with



More information about the tor-commits mailing list