On Sat, Feb 18, 2017 at 07:12:18PM +0000, brian m. carlson wrote: > On Fri, Feb 17, 2017 at 10:15:31PM -0500, Jeff King wrote: > > So for this case, something like the patch below. > > > > Incidentally, there's an off-by-one in the original loop of > > stdin_diff_commit that reads past the end of the trailing NUL for the > > final sha1 on the line. The problem is the: > > > > pos += GIT_SHA1_HEXSZ + 1; > > > > which assumes we're slurping up the trailing space. This works in > > practice because the caller will only permit a string which had a > > newline (which it converted into a NUL). > > > > I suspect that function could be more aggressive about complaining about > > nonsense on the line, rather than silently ignoring it. > > I'd come to basically the same patch, but I did pick up a few niceties > from your patch, like avoiding the off-by-one issue you mentioned above. > Can I place your sign-off on the resulting change? Absolutely. Thanks for taking a look. -Peff