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

Re: [PATCH] Fix off-by-one error: don't read the byte before a malloc'd buffer.

From
Brian Gernhardt <benji@silverinsanity.com>
Date
Dec 9, 2007, 19:24 UTC
Message-ID
<33716C48-068F-42C5-BD84-608EE9017636@silverinsanity.com>
In-Reply-To
<7vsl2bpwe1.fsf@gitster.siamese.dyndns.org>
On Dec 9, 2007, at 1:15 PM, Junio C Hamano wrote:
> The fix may be correct but the comment above the part the patch  
> fixes is
> very misleading and I wasted a few minutes checking to see what it is
> doing is correct.

The fix is correct. I did not anticipate empty strings when I wrote the loop in question. Although I wonder if that should be expanded to use isspace instead of checking for just ' '. I'm less familiar with the config parsing than I was.

Show 6 quoted lines
> The "quote" variable does not really control quoting; the quoting with
> backslash is always done for the value, and this check is about  
> adding a
> dq pair around it, so that the parser does not lose leading or  
> trailing
> SP or string after start-of-comment marker characters.

It's for adding quotes, which made the comment make sense to me. But your expanded description is correct and matches the commit message I wrote. Thanks for clarifying it in the code.

~~ Brian
Previous: Junio C Hamano
Message 3 of 3 in “Fix off-by-one error: don't read the byte before a malloc'd buffer.”
  1. Fix off-by-one error: don't read the byte before a malloc'd buffer.Jim Meyering, Dec 8, 2007
  2. Junio C HamanoDec 9, 2007
  3. Brian GernhardtDec 9, 2007

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.