git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Don Zickus <dzickus@redhat.com>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>,
	Lea Wiemann <lewiemann@gmail.com>,
	git@vger.kernel.org
Subject: Re: [PATCH] mailinfo: avoid violating strbuf assertion
Date: Wed, 20 Aug 2008 14:34:59 -0400	[thread overview]
Message-ID: <20080820183459.GA26052@redhat.com> (raw)
In-Reply-To: <20080819172824.GA9886@coredump.intra.peff.net>

On Tue, Aug 19, 2008 at 01:28:24PM -0400, Jeff King wrote:
> 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>

      reply	other threads:[~2008-08-20 18:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-19 17:28 [PATCH] mailinfo: avoid violating strbuf assertion Jeff King
2008-08-20 18:34 ` Don Zickus [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080820183459.GA26052@redhat.com \
    --to=dzickus@redhat.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=lewiemann@gmail.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).