mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-22 09:24:54 +01:00
Avoid reading a byte just before our allocated buffer.
When looking for a trailing ':' to introduce a quotation we peek at the last character before a newline. But for blank lines, that's not where we want to look. And when the first line in our buffer is a blank line, we're underrunning our buffer. The fix is easy---just bail early on blank lines since they have no terms anyway. Thanks to valgrind for pointing out this error.
This commit is contained in:
parent
387a28281c
commit
dcebf35ec9
1 changed files with 4 additions and 0 deletions
|
@ -486,6 +486,10 @@ gen_terms_body_str (Xapian::TermGenerator term_gen,
|
|||
while (*next_line == '\n')
|
||||
next_line++;
|
||||
|
||||
/* Skip blank lines. */
|
||||
if (line_end < line)
|
||||
continue;
|
||||
|
||||
/* Skip lines that are quotes. */
|
||||
if (*line == '>')
|
||||
continue;
|
||||
|
|
Loading…
Reference in a new issue