aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-11-22 12:38:58 -0500
committerNick Mathewson <nickm@torproject.org>2013-11-22 12:38:58 -0500
commit23dae51976765271239205672c5bfc22472a9606 (patch)
tree3d1602afaa9f0957ca00dc7de7049103c8193699
parenta7410c9199e58bd6c5ff131a994f8e02ccb42b91 (diff)
downloadtor-23dae51976765271239205672c5bfc22472a9606.tar
tor-23dae51976765271239205672c5bfc22472a9606.tar.gz
Only update view of micrdescriptor pos if pos is fetchable.
It's conceivable (but probably impossible given our code) that lseek could return -1 on an error; when that happens, we don't want off to become -1. Fixes CID 1035124.
-rw-r--r--src/or/microdesc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/or/microdesc.c b/src/or/microdesc.c
index f6dd6b611..7765d27da 100644
--- a/src/or/microdesc.c
+++ b/src/or/microdesc.c
@@ -475,7 +475,8 @@ microdesc_cache_rebuild(microdesc_cache_t *cache, int force)
"By my count, I'm at "I64_FORMAT
", but I should be at "I64_FORMAT,
I64_PRINTF_ARG(off), I64_PRINTF_ARG(off_real));
- off = off_real;
+ if (off_real >= 0)
+ off = off_real;
}
if (md->saved_location != SAVED_IN_CACHE) {
tor_free(md->body);