diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-05-16 10:51:02 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-05-16 10:51:02 -0400 |
commit | 3ed4c5dc05a1954a8c68d0f7e9fb802f3155d308 (patch) | |
tree | 99ccbcef357b54ddf8fe7d0a6da963e4a4756c54 /src/or/routerlist.c | |
parent | 8e07798284faba6cc2492ca98e50f2e8bcb70934 (diff) | |
download | tor-3ed4c5dc05a1954a8c68d0f7e9fb802f3155d308.tar.gz tor-3ed4c5dc05a1954a8c68d0f7e9fb802f3155d308.zip |
Correct the bulletproofing of routerlist_insert()
The original code updated some variables, but forgot to remove a
replaced old-routerdesc from rl->old_routers.
Related to bug 1776.
Diffstat (limited to 'src/or/routerlist.c')
-rw-r--r-- | src/or/routerlist.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 86cdb83d9d..d21b40c57d 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -2815,6 +2815,13 @@ routerlist_insert(routerlist_t *rl, routerinfo_t *ri) ri->cache_info.signed_descriptor_digest, &(ri->cache_info)); if (sd_old) { + int idx = sd_old->routerlist_index; + sd_old->routerlist_index = -1; + smartlist_del(rl->old_routers, idx); + if (idx < smartlist_len(rl->old_routers)) { + signed_descriptor_t *d = smartlist_get(rl->old_routers, idx); + d->routerlist_index = idx; + } rl->desc_store.bytes_dropped += sd_old->signed_descriptor_len; sdmap_remove(rl->desc_by_eid_map, sd_old->extra_info_digest); signed_descriptor_free(sd_old); |