api: Handle NULs and newlines in buffer_*_line.
api: Add tests for when not to handle NULs.