Jeff King writes:
> - len = strlen((const char *)data);
> - next = data + len + 1;
> - if (next > rd->end)
> + eos = memchr(data, '\0', end - data);
> + if (!eos || eos == end)
> return -1;
> + len = eos - data;
> + next = eos + 1;
Yup, much nicer.
> -
The on-disk format for the untracked-cache extension contains
NUL-terminated filenames. We parse these from the mmap'd file using
string functions like strlen(). This works fine in the normal case, but
if we see a malformed or corrupted index, we might read off the end of
our mmap.
Instead, let's
2 matches
Mail list logo