Merge branch 'maint-0.3.1' into maint-0.3.2

This commit is contained in:
Nick Mathewson 2018-01-18 08:13:48 -05:00
commit 44388757c4
2 changed files with 8 additions and 1 deletions

4
changes/bug24826_031 Normal file
View File

@ -0,0 +1,4 @@
o Minor bugfixes (performance, fragile-hardening):
- Improve the performance of our consensus-diff application code when Tor
is built with the --enable-fragile-hardening option set. Fixes bug
24826; bugfix on 0.3.1.1-alpha.

View File

@ -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;