aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrl1987 <rl1987@sdf.lonestar.org>2019-05-17 19:44:45 +0300
committerNick Mathewson <nickm@torproject.org>2019-05-20 09:08:10 -0400
commit2845607f9706dc00aa799fc609d692e8d8c4786f (patch)
treed0e85a1ef32041fc8ac2e2058756d17971f065bd /src
parent49acbfad23df415977fb7a196c6aae2d7406b489 (diff)
downloadtor-2845607f9706dc00aa799fc609d692e8d8c4786f.tar.gz
tor-2845607f9706dc00aa799fc609d692e8d8c4786f.zip
In microdesc_cache_reload(), set journal length to length of string we read
Hopefully this will fix CID 1444769.
Diffstat (limited to 'src')
-rw-r--r--src/feature/nodelist/microdesc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/feature/nodelist/microdesc.c b/src/feature/nodelist/microdesc.c
index db2149754a..89ac0a2f83 100644
--- a/src/feature/nodelist/microdesc.c
+++ b/src/feature/nodelist/microdesc.c
@@ -536,8 +536,8 @@ microdesc_cache_reload(microdesc_cache_t *cache)
journal_content = read_file_to_str(cache->journal_fname,
RFTS_IGNORE_MISSING, &st);
if (journal_content) {
- cache->journal_len = (size_t) st.st_size;
- warn_if_nul_found(journal_content, cache->journal_len, 0,
+ cache->journal_len = strlen(journal_content);
+ warn_if_nul_found(journal_content, (size_t)st.st_size, 0,
"reading microdesc journal");
added = microdescs_add_to_cache(cache, journal_content,
journal_content+st.st_size,