git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] tree-walk: don't parse incorrect entries

From
MKMartin Koegler <mkoegler@auto.tuwien.ac.at>
Date
Jan 6, 2008, 17:23 UTC
Message-ID
<20080106172322.GA27967@auto.tuwien.ac.at>
In-Reply-To
<7v1w8w80a3.fsf@gitster.siamese.dyndns.org>
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?
Yes, I agree with 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
Previous: Junio C Hamano
Message 3 of 3 in “tree-walk: don't parse incorrect entries”
  1. tree-walk: don't parse incorrect entriesMartin Koegler, Jan 5, 2008
  2. Junio C HamanoJan 5, 2008
  3. Martin KoeglerJan 6, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.