summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-10-29 15:57:31 -0400
committerNick Mathewson <nickm@torproject.org>2018-10-29 15:57:31 -0400
commitfda8b5de78f0f436557b2e5c0a87df8450f91e85 (patch)
tree25a01aa3c6cf08d33d9e029b11c095f0b3f64db8 /src
parentb43c4465236bca0c0847d29005d387ee885e3985 (diff)
parent9d75f7984641e0bff230bf22eb5d5b29383236d6 (diff)
downloadtor-fda8b5de78f0f436557b2e5c0a87df8450f91e85.tar.gz
tor-fda8b5de78f0f436557b2e5c0a87df8450f91e85.zip
Merge branch 'maint-0.3.5'
Diffstat (limited to 'src')
-rw-r--r--src/feature/dirparse/microdesc_parse.c6
-rw-r--r--src/feature/dirparse/parsecommon.c2
2 files changed, 4 insertions, 4 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();
diff --git a/src/feature/dirparse/parsecommon.c b/src/feature/dirparse/parsecommon.c
index c12f199e4e..e00af0eea2 100644
--- a/src/feature/dirparse/parsecommon.c
+++ b/src/feature/dirparse/parsecommon.c
@@ -353,7 +353,7 @@ get_next_token(memarea_t *area,
goto check_object;
obstart = *s; /* Set obstart to start of object spec */
- if (*s+16 >= eol || memchr(*s+11,'\0',eol-*s-16) || /* no short lines, */
+ if (eol - *s <= 16 || memchr(*s+11,'\0',eol-*s-16) || /* no short lines, */
strcmp_len(eol-5, "-----", 5) || /* nuls or invalid endings */
(eol-*s) > MAX_UNPARSED_OBJECT_SIZE) { /* name too long */
RET_ERR("Malformed object: bad begin line");