Jeff King [off-list ref] writes:
We could also just make a NUL-terminated copy of the input
bytes and operate on that. But since all but one caller
already is passing a string, instead let's just fix that
caller to provide NUL-terminated input in the first place,
by swapping out mmap for strbuf_read_file().
...
Let's also drop the "len" parameter entirely from
link_alt_odb_entries(), since it's completely ignored. That
will avoid any new callers re-introducing a similar bug.
Both design decisions make perfect sense to me.
sha1_file.c | 29 +++++++++--------------------
1 file changed, 9 insertions(+), 20 deletions(-)
And diffstat also agrees that it is a good change ;-)