aboutsummaryrefslogtreecommitdiff
path: root/src/feature/dirparse/microdesc_parse.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-10-25 09:15:53 -0400
committerNick Mathewson <nickm@torproject.org>2018-10-25 09:16:08 -0400
commite9ff3e7d4a1be799359db9da40e2bf588075359c (patch)
tree561b012ac36a49d245a6b6e12dc864a2a899af77 /src/feature/dirparse/microdesc_parse.c
parentc78904b6302c53e0778854974c13aa4d5a499bb0 (diff)
parent8013e3e8b6af4170f622765a0fb1a219131028bd (diff)
downloadtor-e9ff3e7d4a1be799359db9da40e2bf588075359c.tar.gz
tor-e9ff3e7d4a1be799359db9da40e2bf588075359c.zip
Merge branch 'bug28202_033' into bug28202_035
Diffstat (limited to 'src/feature/dirparse/microdesc_parse.c')
-rw-r--r--src/feature/dirparse/microdesc_parse.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/feature/dirparse/microdesc_parse.c b/src/feature/dirparse/microdesc_parse.c
index 005d2c53d0..aebff5a35f 100644
--- a/src/feature/dirparse/microdesc_parse.c
+++ b/src/feature/dirparse/microdesc_parse.c
@@ -50,13 +50,13 @@ find_start_of_next_microdesc(const char *s, const char *eos)
return NULL;
#define CHECK_LENGTH() STMT_BEGIN \
- if (s+32 > eos) \
+ if (eos - s < 32) \
return NULL; \
STMT_END
#define NEXT_LINE() STMT_BEGIN \
s = memchr(s, '\n', eos-s); \
- if (!s || s+1 >= eos) \
+ if (!s || eos - s <= 1) \
return NULL; \
s++; \
STMT_END
@@ -80,7 +80,7 @@ find_start_of_next_microdesc(const char *s, const char *eos)
/* Okay, now we're pointed at the first line of the microdescriptor which is
not an annotation or onion-key. The next line that _is_ an annotation or
onion-key is the start of the next microdescriptor. */
- while (s+32 < eos) {
+ while (eos - s > 32) {
if (*s == '@' || !strcmpstart(s, "onion-key"))
return s;
NEXT_LINE();