Re: [PATCH v2 3/6] Make sure fsck_commit_buffer() does not run out of the buffer

2014-09-10 Thread Junio C Hamano
Johannes Schindelin writes: > So far, we assumed that the buffer is NUL terminated, but this is not > a safe assumption, now that we opened the fsck_object() API to pass a > buffer directly. > > So let's make sure that there is at least an empty line in the buffer. > That way, our checks would fa

Re: [PATCH v2 3/6] Make sure fsck_commit_buffer() does not run out of the buffer

2014-09-10 Thread Eric Sunshine
On Wed, Sep 10, 2014 at 9:52 AM, Johannes Schindelin wrote: > So far, we assumed that the buffer is NUL terminated, but this is not > a safe assumption, now that we opened the fsck_object() API to pass a > buffer directly. > > So let's make sure that there is at least an empty line in the buffer.

Re: [PATCH v2 3/6] Make sure fsck_commit_buffer() does not run out of the buffer

2014-09-11 Thread Johannes Schindelin
Hi Junio, On Wed, 10 Sep 2014, Junio C Hamano wrote: > Johannes Schindelin writes: > > > diff --git a/fsck.c b/fsck.c > > index dd77628..9dd7d12 100644 > > --- a/fsck.c > > +++ b/fsck.c > > @@ -237,6 +237,26 @@ static int fsck_tree(struct tree *item, int strict, > > fsck_error error_func) > >

Re: [PATCH v2 3/6] Make sure fsck_commit_buffer() does not run out of the buffer

2014-09-11 Thread Junio C Hamano
Johannes Schindelin writes: >> > + for (i = 0; i < size; i++) { >> > + switch (buffer[i]) { >> > + case '\0': >> > + return error_func(obj, FSCK_ERROR, >> > + "invalid message: NUL at offset %d", i); >> >> Isn't this "invalid header"?