[PATCH] setup.c: Fix prefix_pathspec from looping pass end of string

2013-03-07 Thread Andrew Wong
The previous code was assuming length ends at either `)` or `,`, and was not handling the case where strcspn returns length due to end of string. So specifying ":(top" as pathspec will cause the loop to go pass the end of string. Signed-off-by: Andrew Wong --- setup.c | 6 -- 1 file changed,

Re: [PATCH] setup.c: Fix prefix_pathspec from looping pass end of string

2013-03-07 Thread Junio C Hamano
Andrew Wong writes: > The previous code was assuming length ends at either `)` or `,`, and was > not handling the case where strcspn returns length due to end of string. > So specifying ":(top" as pathspec will cause the loop to go pass the end > of string. Thanks. The parser that goes past the

Re: [PATCH] setup.c: Fix prefix_pathspec from looping pass end of string

2013-03-07 Thread Andrew Wong
On 3/7/13, Junio C Hamano wrote: > The parser that goes past the end of the string may be a bug worth > fixing, but is this patch sufficient to diagnose such an input as an > error? Yea, the patch should fix the passing end of string too. The parser was going past end of string because the nextat

Re: [PATCH] setup.c: Fix prefix_pathspec from looping pass end of string

2013-03-07 Thread Junio C Hamano
Andrew Wong writes: > On 3/7/13, Junio C Hamano wrote: >> The parser that goes past the end of the string may be a bug worth >> fixing, but is this patch sufficient to diagnose such an input as an >> error? > > Yea, the patch should fix the passing end of string too. The parser > was going past

Re: [PATCH] setup.c: Fix prefix_pathspec from looping pass end of string

2013-03-07 Thread Andrew Wong
On 3/7/13, Junio C Hamano wrote: > This did not error out for me, though. > > $ cd t && git ls-files ":(top" No error message at all? Hm, maybe in your case, the byte after the end of string happens to be '\0' and the loop ended by chance? git doesn't crash for me, but it generates this erro

Re: [PATCH] setup.c: Fix prefix_pathspec from looping pass end of string

2013-03-07 Thread Junio C Hamano
Andrew Wong writes: > On 3/7/13, Junio C Hamano wrote: >> This did not error out for me, though. >> >> $ cd t && git ls-files ":(top" > > No error message at all? Hm, maybe in your case, the byte after the > end of string happens to be '\0' and the loop ended by chance? > > git doesn't crash

Re: [PATCH] setup.c: Fix prefix_pathspec from looping pass end of string

2013-03-07 Thread Andrew Wong
On 03/07/13 20:51, Junio C Hamano wrote: > But it is equally broken to behave as if there is nothing wrong in > the incomplete magic ":(top" that is not closed, isn't it? Ah, yea, I did notice that, but then I saw a few lines below: if (*copyfrom == ')') copyfrom++; which is exp