Fixes to safely reading the index

Avoid wrapping around extension size when reading, avoid walking off
the end of the buffer when reading names.
git_strndup fix when OOM
Merge pull request #1770 from ethomson/index_fuzz

Fixes to safely reading the index