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 johannes.schinde...@gmx.de 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

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 johannes.schinde...@gmx.de 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

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

2014-09-10 Thread Johannes Schindelin
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 fail if the empty line was encountered

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 johannes.schinde...@gmx.de 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

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 johannes.schinde...@gmx.de 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