In microdesc_cache_reload(), set journal length to length of string we read

Hopefully this will fix CID 1444769.
This commit is contained in:
rl1987 2019-05-17 19:44:45 +03:00 committed by Nick Mathewson
parent 49acbfad23
commit 2845607f97

View File

@ -536,8 +536,8 @@ microdesc_cache_reload(microdesc_cache_t *cache)
journal_content = read_file_to_str(cache->journal_fname, journal_content = read_file_to_str(cache->journal_fname,
RFTS_IGNORE_MISSING, &st); RFTS_IGNORE_MISSING, &st);
if (journal_content) { if (journal_content) {
cache->journal_len = (size_t) st.st_size; cache->journal_len = strlen(journal_content);
warn_if_nul_found(journal_content, cache->journal_len, 0, warn_if_nul_found(journal_content, (size_t)st.st_size, 0,
"reading microdesc journal"); "reading microdesc journal");
added = microdescs_add_to_cache(cache, journal_content, added = microdescs_add_to_cache(cache, journal_content,
journal_content+st.st_size, journal_content+st.st_size,