Re: [PATCH] fsck: properly bound "invalid tag name" error message

2014-12-08 Thread Johannes Schindelin
Hi Peff, On Mon, 8 Dec 2014, Jeff King wrote: > On Mon, Dec 08, 2014 at 12:35:27PM +0100, Johannes Schindelin wrote: > > > On Mon, 8 Dec 2014, Duy Nguyen wrote: > > > > > On Mon, Dec 08, 2014 at 12:57:06AM -0500, Jeff King wrote: > > > > I do admit that I am tempted to teach index-pack to alway

Re: [PATCH] fsck: properly bound "invalid tag name" error message

2014-12-08 Thread Jeff King
On Mon, Dec 08, 2014 at 12:35:27PM +0100, Johannes Schindelin wrote: > On Mon, 8 Dec 2014, Duy Nguyen wrote: > > > On Mon, Dec 08, 2014 at 12:57:06AM -0500, Jeff King wrote: > > > I do admit that I am tempted to teach index-pack to always NUL-terminate > > > objects in memory that we feed to fsck

Re: [PATCH] fsck: properly bound "invalid tag name" error message

2014-12-08 Thread Johannes Schindelin
Hi Duy, On Mon, 8 Dec 2014, Duy Nguyen wrote: > On Mon, Dec 08, 2014 at 12:57:06AM -0500, Jeff King wrote: > > I do admit that I am tempted to teach index-pack to always NUL-terminate > > objects in memory that we feed to fsck, just to be on the safe side. It > > doesn't cost much, and could prev

Re: [PATCH] fsck: properly bound "invalid tag name" error message

2014-12-08 Thread Jeff King
On Mon, Dec 08, 2014 at 12:17:10PM +0100, Johannes Schindelin wrote: > > I do admit that I am tempted to teach index-pack to always NUL-terminate > > objects in memory that we feed to fsck, just to be on the safe side. It > > doesn't cost much, and could prevent a silly mistake (either in the > >

Re: [PATCH] fsck: properly bound "invalid tag name" error message

2014-12-08 Thread Duy Nguyen
On Mon, Dec 08, 2014 at 12:57:06AM -0500, Jeff King wrote: > I do admit that I am tempted to teach index-pack to always NUL-terminate > objects in memory that we feed to fsck, just to be on the safe side. It > doesn't cost much, and could prevent a silly mistake (either in the > future, or one that

Re: [PATCH] fsck: properly bound "invalid tag name" error message

2014-12-08 Thread Johannes Schindelin
Hi, On Mon, 8 Dec 2014, Jeff King wrote: > On Mon, Dec 08, 2014 at 12:48:12AM -0500, Jeff King wrote: > > > Note that when fscking tags with "index-pack --strict", this is even > > worse. index-pack does not add a trailing NUL-terminator after the > > object, so we may actually read past the buf

Re: [PATCH] fsck: properly bound "invalid tag name" error message

2014-12-08 Thread Johannes Schindelin
Hi Peff, On Mon, 8 Dec 2014, Jeff King wrote: > When we detect an invalid tag-name header in a tag object, > like, "tag foo bar\n", we feed the pointer starting at "foo > bar" to a printf "%s" formatter. This shows the name, as we > want, but then it keeps printing the rest of the tag buffer, > r

Re: [PATCH] fsck: properly bound "invalid tag name" error message

2014-12-07 Thread Jeff King
On Mon, Dec 08, 2014 at 12:48:12AM -0500, Jeff King wrote: > Note that when fscking tags with "index-pack --strict", this > is even worse. index-pack does not add a trailing > NUL-terminator after the object, so we may actually read > past the buffer and print uninitialized memory. Running > t5302

[PATCH] fsck: properly bound "invalid tag name" error message

2014-12-07 Thread Jeff King
When we detect an invalid tag-name header in a tag object, like, "tag foo bar\n", we feed the pointer starting at "foo bar" to a printf "%s" formatter. This shows the name, as we want, but then it keeps printing the rest of the tag buffer, rather than stopping at the end of the line. Our tests did