Make it safe to always use `data` as a character string
Add missing null terminator after realloc (buffer resize)
Merge pull request #2 from deltheil/master

Extra slot for null terminator