Re: [PATCH 06/10] get_short_sha1: NUL-terminate hex prefix

2016-09-26 Thread Jeff King
On Mon, Sep 26, 2016 at 10:10:46AM -0700, Junio C Hamano wrote: > > struct disambiguate_state { > > int len; /* length of prefix in hex chars */ > > - char hex_pfx[GIT_SHA1_HEXSZ]; > > + char hex_pfx[GIT_SHA1_HEXSZ + 1]; > > unsigned char bin_pfx[GIT_SHA1_RAWSZ]; > > > >

Re: [PATCH 06/10] get_short_sha1: NUL-terminate hex prefix

2016-09-26 Thread Junio C Hamano
Jeff King writes: > We store the hex prefix in a 40-byte buffer with the prefix > itself followed by 40-minus-len "x" characters. These x's > serve no purpose, and the lack of NUL termination makes the > prefix string annoying to use. Let's just terminate it. > Note that this is

[PATCH 06/10] get_short_sha1: NUL-terminate hex prefix

2016-09-26 Thread Jeff King
We store the hex prefix in a 40-byte buffer with the prefix itself followed by 40-minus-len "x" characters. These x's serve no purpose, and the lack of NUL termination makes the prefix string annoying to use. Let's just terminate it. Note that this is in contrast to the binary prefix, which