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

Re: [PATCH] mailinfo: avoid violating strbuf assertion

From
DZDon Zickus <dzickus@redhat.com>
Date
Aug 20, 2008, 18:34 UTC
Message-ID
<20080820183459.GA26052@redhat.com>
In-Reply-To
<20080819172824.GA9886@coredump.intra.peff.net>
On Tue, Aug 19, 2008 at 01:28:24PM -0400, Jeff King wrote:
Show 17 quoted lines
> In handle_from, we calculate the end boundary of a section
> to remove from a strbuf using strcspn like this:
> 
>   el = strcspn(buf, set_of_end_boundaries);
>   strbuf_remove(&sb, start, el + 1);
> 
> This works fine if "el" is the offset of the boundary
> character, meaning we remove up to and including that
> character. But if the end boundary didn't match (that is, we
> hit the end of the string as the boundary instead) then we
> want just "el". Asking for "el+1" caught an out-of-bounds
> assertion in the strbuf library.
> 
> This manifested itself when we got a 'From' header that had
> just an email address with nothing else in it (the end of
> the string was the end of the address, rather than, e.g., a
> trailing '>' character), causing git-mailinfo to barf.

Odd, I just ran into this myself today too. Wonder if we share the same culprit.. :-)

Tested-by: Don Zickus <dzickus@redhat.com>
Previous: Jeff King
Message 2 of 2 in “mailinfo: avoid violating strbuf assertion”
  1. mailinfo: avoid violating strbuf assertionJeff King, Aug 19, 2008
  2. Don ZickusAug 20, 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.