Fix for buffer overflow on read failure
Merge pull request #11 from langholz/OverflowOnReadFailure

Fix for buffer overflow on read failure