aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-01-18 08:13:48 -0500
committerNick Mathewson <nickm@torproject.org>2018-01-18 08:13:48 -0500
commitc8a27d89b26394a0e802820fe891ef75787499ab (patch)
treeaa601dffbdc8b4e08025c7f2c052193f8474fd5b /src
parent77026f8a87064efc926f0be1e65c922f5e4ea238 (diff)
parent44388757c44834d63614c4e13cf88931992afc2a (diff)
downloadtor-c8a27d89b26394a0e802820fe891ef75787499ab.tar.gz
tor-c8a27d89b26394a0e802820fe891ef75787499ab.zip
Merge branch 'maint-0.3.2'
Diffstat (limited to 'src')
-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 1baa11897c..deaf465fe7 100644
--- a/src/or/consdiff.c
+++ b/src/or/consdiff.c
@@ -1285,8 +1285,11 @@ consdiff_apply_diff(const smartlist_t *cons1,
STATIC int
consensus_split_lines(smartlist_t *out, const char *s, memarea_t *area)
{
+ const char *end_of_str = s + strlen(s);
+ tor_assert(*end_of_str == '\0');
+
while (*s) {
- const char *eol = strchr(s, '\n');
+ const char *eol = memchr(s, '\n', end_of_str - s);
if (!eol) {
/* File doesn't end with newline. */
return -1;