]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Only update view of micrdescriptor pos if pos is fetchable.
authorNick Mathewson <nickm@torproject.org>
Fri, 22 Nov 2013 17:38:58 +0000 (12:38 -0500)
committerNick Mathewson <nickm@torproject.org>
Fri, 22 Nov 2013 17:38:58 +0000 (12:38 -0500)
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.

src/or/microdesc.c

index f6dd6b611b887746e3f266e79fb0ad0904f9bc01..7765d27da60ccf12392c0701c43689aca1c71f2a 100644 (file)
@@ -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);