The function readAllBuffer() always returned a string that was a
multiple of the BufSize in length, regardless of how many bytes were
actually read, padding the result with garbage bytes on the last chunk.
This fix properly trims the last chunk to its actual size.