Re: [PATCH] tree-walk: don't parse incorrect entries
On Sat, Jan 05, 2008 at 12:50:28PM -0800, Junio C Hamano wrote:
Show 17 quoted lines
> Martin Koegler <mkoegler@auto.tuwien.ac.at> writes:
> > * The start of the path may not be after the last zero (21 bytes before the end).
>
> How can that be possible?
>
> - you know end points at NUL and buf < end;
>
> - get_mode() starts scanning from buf, stops at the first SP if
> returns a non NULL pointer; anything non octal digit before
> it sees that SP results in a NULL return;
>
> - the return value of get_mode() is the beginning of the path.
>
> The second point above means when get_mode() scans buf, it would
> never go beyond end which you already made sure is NUL (which is
> not SP and not an octal digit). If it hits end, you would get NULL
> pointer back, wouldn't you?
> Rejecting an empty path may be sensible (i.e. checking "!*path"
> instead), though.
I sent a new patch with both changes.
mfg Martin Kögler