diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-01-18 08:13:45 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-01-18 08:13:45 -0500 |
commit | f406b9df0533c9730b4537b39f3a7f8d232f3558 (patch) | |
tree | c37a52cc4ae3becf6a6f58eef3c9c64c5b351ba4 /src/or | |
parent | af8cadf3a9febe3dbe22899b828f9f7946a82cef (diff) | |
parent | 4bb831e0873e7e4468a44dbf9e253bcd5df18421 (diff) | |
download | tor-f406b9df0533c9730b4537b39f3a7f8d232f3558.tar.gz tor-f406b9df0533c9730b4537b39f3a7f8d232f3558.zip |
Merge branch 'bug24826_031' into maint-0.3.1
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/consdiff.c | 5 |
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; |