Increase buffer size to more than worst-case maximum size so it can't overflow.
Fix lost last line when line count is odd.