summaryrefslogtreecommitdiff
path: root/src/or/consdiff.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-03-15 16:43:24 -0400
committerNick Mathewson <nickm@torproject.org>2017-03-16 14:42:56 -0400
commit83049cebc0b3c8221f0b2a7d0848acf9477478c4 (patch)
tree1a66fc13b4009a6801d4a0c0421cae0c4cffa902 /src/or/consdiff.c
parent5e8143642848debdbbb98c4490d64822a0908b88 (diff)
downloadtor-83049cebc0b3c8221f0b2a7d0848acf9477478c4.tar.gz
tor-83049cebc0b3c8221f0b2a7d0848acf9477478c4.zip
Make CONSENSUS_LINE_MAX_LEN a real define
Diffstat (limited to 'src/or/consdiff.c')
-rw-r--r--src/or/consdiff.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/or/consdiff.c b/src/or/consdiff.c
index a01299c747..2a97797f3f 100644
--- a/src/or/consdiff.c
+++ b/src/or/consdiff.c
@@ -1139,6 +1139,9 @@ consdiff_apply_diff(const smartlist_t *cons1,
return cons2_str;
}
+/** Any consensus line longer than this means that the input is invalid. */
+#define CONSENSUS_LINE_MAX_LEN (1<<20)
+
/**
* Helper: For every NL-terminated line in <b>s</b>, add a cdline referring to
* that line (without trailing newline) to <b>out</b>. Return -1 if there are
@@ -1160,7 +1163,7 @@ consensus_split_lines(smartlist_t *out, const char *s, memarea_t *area)
/* File doesn't end with newline. */
return -1;
}
- if (eol - s > UINT32_MAX) {
+ if (eol - s > CONSENSUS_LINE_MAX_LEN) {
/* Line is far too long. */
return -1;
}