Re: [PATCH 1/2] read_info_alternates: read contents into strbuf

2017-09-18 Thread Jeff King
On Mon, Sep 18, 2017 at 07:42:53PM -0700, Jonathan Nieder wrote: > Jeff King wrote: > > > Reported-by: Michael Haggerty > > Signed-off-by: Jeff King > > --- > > sha1_file.c | 29 + > > 1 file changed, 9 insertions(+), 20

Re: [PATCH 1/2] read_info_alternates: read contents into strbuf

2017-09-18 Thread Jonathan Nieder
Jeff King wrote: > Reported-by: Michael Haggerty > Signed-off-by: Jeff King > --- > sha1_file.c | 29 + > 1 file changed, 9 insertions(+), 20 deletions(-) Thanks for tracking it down. Reviewed-by: Jonathan Nieder

Re: [PATCH 1/2] read_info_alternates: read contents into strbuf

2017-09-18 Thread Junio C Hamano
Jeff King 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

[PATCH 1/2] read_info_alternates: read contents into strbuf

2017-09-18 Thread Jeff King
The link_alt_odb_entries() function has always taken a ptr/len pair as input. Until cf3c635210 (alternates: accept double-quoted paths, 2016-12-12), we made a copy of those bytes in a string. But after that commit, we switched to parsing the input left-to-right, and we ignore "len" totally,