The "unexpected label source in mrsets" test caused a read past the
end of the input buffer in text_parse_counted_string(). This fixes
the problem.
Found by Valgrind.
Reported-by: John Darrington <john@darrington.wattle.id.au>
start = text->pos;
n = 0;
- for (;;)
+ while (text->pos < text->buffer.length)
{
int c = text->buffer.string[text->pos];
if (c < '0' || c > '9')
n = (n * 10) + (c - '0');
text->pos++;
}
- if (start == text->pos)
+ if (text->pos >= text->buffer.length || start == text->pos)
{
sys_warn (r, text->start,
_("Expecting digit at offset %zu in MRSETS record."),