Do not assume blob contents are NULL terminated

These are all the cases I could find on the codebase.

cc @ethomson @carlosmn 
Swapping `git__strdup()` for `git__strndup()` would give us the same result here, while keeping the OOM check as it was.