Redmine#1032: fix 1-byte read issue

* with 1-byte strings, we still need to ensure the last newline is stripped
* use `size`, not `buflen` for clarity