aboutsummaryrefslogtreecommitdiff
path: root/src/or/circuitlist.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2009-09-22 22:09:33 -0400
committerRoger Dingledine <arma@torproject.org>2009-09-22 22:09:33 -0400
commit0d13e0ed145f4c1b5bd1623ab529d24208304390 (patch)
tree9683c2e5445686afa94c70c8114b4c8e6d3fc0ea /src/or/circuitlist.c
parent6acfa31d5989ccb15812610669351b9206285905 (diff)
downloadtor-0d13e0ed145f4c1b5bd1623ab529d24208304390.tar.gz
tor-0d13e0ed145f4c1b5bd1623ab529d24208304390.zip
Be more robust to bad circwindow values
If the networkstatus consensus tells us that we should use a negative circuit package window, ignore it. Otherwise we'll believe it and then trigger an assert. Also, change the interface for networkstatus_get_param() so we don't have to lookup the consensus beforehand.
Diffstat (limited to 'src/or/circuitlist.c')
-rw-r--r--src/or/circuitlist.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index 259666732a..560bec55f1 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -367,10 +367,11 @@ circuit_purpose_to_controller_string(uint8_t purpose)
int32_t
circuit_initial_package_window(void)
{
- networkstatus_t *consensus = networkstatus_get_latest_consensus();
- if (consensus)
- return networkstatus_get_param(consensus, "circwindow", CIRCWINDOW_START);
- return CIRCWINDOW_START;
+ int32_t num = networkstatus_get_param(NULL, "circwindow", CIRCWINDOW_START);
+ /* If the consensus tells us a negative number, we'd assert. */
+ if (num < 0)
+ num = CIRCWINDOW_START;
+ return num;
}
/** Initialize the common elements in a circuit_t, and add it to the global