buffer: Do not `put` anything if len is 0
attr_file: Do not assume ODB data is NULL-terminated

That's a bad assumption to make, even though right now it holds
(because of the way we've implemented decompression of packfiles),
this may change in the future, given that ODB objects can be
binary data.

Furthermore, the ODB object can return a NULL pointer if the object
is empty. Copying the NULL pointer to the strbuf lets us handle it
like an empty string. Again, the NULL pointer is valid behavior because
you're supposed to check the *size* of the object before working
on it.
notes: Do not assume blob contents are NULL-terminated
blame: Do not assume blob contents are NULL-terminated
notes: Use `git__strndup`
text: Null-terminate a string if we've been gouging it
Merge pull request #2725 from libgit2/vmg/attr-null

Do not assume blob contents are NULL terminated