diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-09-10 10:35:18 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-09-10 10:35:18 -0400 |
commit | 8731a4e148e23d8edbb7f32bdfeee30c326f33cc (patch) | |
tree | 3dab2cef71b8bd6e2ddc28f2cdb39b69cfddf4f3 /src | |
parent | 97dbff51e60273b29d7dc15e4106c600e8efa34e (diff) | |
download | tor-8731a4e148e23d8edbb7f32bdfeee30c326f33cc.tar.gz tor-8731a4e148e23d8edbb7f32bdfeee30c326f33cc.zip |
Avoid segfault when reading state file from ancient tor
If s_values is null in rep_hist_load_bwhist_state_section, we would
call smartlist_len() on it, and die.
Fixes bug 6801.
Diffstat (limited to 'src')
-rw-r--r-- | src/or/rephist.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/or/rephist.c b/src/or/rephist.c index 720d14cf45..3b0d9dd35f 100644 --- a/src/or/rephist.c +++ b/src/or/rephist.c @@ -1675,7 +1675,8 @@ rep_hist_load_bwhist_state_section(bw_array_t *b, uint64_t v, mv; int i,ok,ok_m; - int have_maxima = (smartlist_len(s_values) == smartlist_len(s_maxima)); + int have_maxima = s_maxima && s_values && + (smartlist_len(s_values) == smartlist_len(s_maxima)); if (s_values && s_begins >= now - NUM_SECS_BW_SUM_INTERVAL*NUM_TOTALS) { start = s_begins - s_interval*(smartlist_len(s_values)); |