diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-06-12 12:12:11 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-06-12 12:12:11 -0400 |
commit | e602c4031b57f0780661ce0473a5e30d187d385c (patch) | |
tree | 95b222a72c289ce457faf152e3392c3329ad2190 /src/or/microdesc.c | |
parent | f455686b77e4ac686251c6edf1f4a506a369866c (diff) | |
download | tor-e602c4031b57f0780661ce0473a5e30d187d385c.tar.gz tor-e602c4031b57f0780661ce0473a5e30d187d385c.zip |
Make all consumers of microdesc_t.body tolerate NULL
This is another fix to try to mitigate recurrences of 8031/8822.
Diffstat (limited to 'src/or/microdesc.c')
-rw-r--r-- | src/or/microdesc.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/or/microdesc.c b/src/or/microdesc.c index f99e1c88ad..05e3b41815 100644 --- a/src/or/microdesc.c +++ b/src/or/microdesc.c @@ -75,6 +75,10 @@ dump_microdescriptor(int fd, microdesc_t *md, size_t *annotation_len_out) { ssize_t r = 0; size_t written; + if (md->body == NULL) { + *annotation_len_out = 0; + return 0; + } /* XXXX drops unknown annotations. */ if (md->last_listed) { char buf[ISO_TIME_LEN+1]; @@ -447,7 +451,7 @@ microdesc_cache_rebuild(microdesc_cache_t *cache, int force) HT_FOREACH(mdp, microdesc_map, &cache->map) { microdesc_t *md = *mdp; size_t annotation_len; - if (md->no_save) + if (md->no_save || !md->body) continue; size = dump_microdescriptor(fd, md, &annotation_len); |