From: Jeff King <peff@peff.net>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
Brian Gianforcaro <b.gianfo@gmail.com>,
Marius Storm-Olsen <marius@trolltech.com>,
Junio C Hamano <junkio@cox.net>
Subject: Re: [PATCH 1/3] blame: fix email output with mailmap
Date: Sat, 4 Feb 2012 18:39:09 -0500 [thread overview]
Message-ID: <20120204233909.GA1366@sigill.intra.peff.net> (raw)
In-Reply-To: <1328385024-6955-2-git-send-email-felipe.contreras@gmail.com>
On Sat, Feb 04, 2012 at 09:50:22PM +0200, Felipe Contreras wrote:
> diff --git a/builtin/blame.c b/builtin/blame.c
> index 5a67c20..dd69e51 100644
> --- a/builtin/blame.c
> +++ b/builtin/blame.c
> @@ -1403,10 +1403,13 @@ static void get_ac_line(const char *inbuf, const char *what,
> * Now, convert both name and e-mail using mailmap
> */
> if (map_user(&mailmap, mail+1, mail_len-1, person, tmp-person-1)) {
> - /* Add a trailing '>' to email, since map_user returns plain emails
> - Note: It already has '<', since we replace from mail+1 */
> + /*
> + * Add a trailing '>' to email, since map_user returns plain
> + * emails when it finds a matching mail.
> + * Note: It already has '<', since we replace from mail + 1
> + */
> mailpos = memchr(mail, '\0', mail_len);
> - if (mailpos && mailpos-mail < mail_len - 1) {
> + if (mailpos && mailpos-mail < mail_len - 1 && *(mailpos - 1) != '>') {
> *mailpos = '>';
> *(mailpos+1) = '\0';
I'm not sure if it's possible, but do you need to be checking that
"mailpos > mail" to avoid reading off the beginning of the buffer?
It would mean the email field is empty, which may or may not be
possible.
-Peff
next prev parent reply other threads:[~2012-02-04 23:39 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-04 19:50 [PATCH 0/3] blame: fix output with mailmap Felipe Contreras
2012-02-04 19:50 ` [PATCH 1/3] blame: fix email " Felipe Contreras
2012-02-04 23:39 ` Jeff King [this message]
2012-02-05 19:57 ` Thomas Rast
2012-02-05 20:58 ` Felipe Contreras
2012-02-06 4:09 ` Jeff King
2012-02-04 19:50 ` [PATCH 2/3] t: mailmap: add 'git blame -e' tests Felipe Contreras
2012-02-04 20:10 ` Jonathan Nieder
2012-02-04 21:04 ` Felipe Contreras
2012-02-04 21:13 ` Jonathan Nieder
2012-02-04 21:59 ` Felipe Contreras
2012-02-05 20:38 ` Junio C Hamano
2012-02-05 21:07 ` Felipe Contreras
2012-02-04 19:50 ` [PATCH 3/3] t: mailmap: add simple name translation test Felipe Contreras
2012-02-04 20:12 ` Jonathan Nieder
2012-02-04 21:05 ` Felipe Contreras
2012-02-04 21:15 ` Jonathan Nieder
2012-02-04 22:19 ` Felipe Contreras
2012-02-04 23:42 ` Jeff King
2012-02-06 21:32 ` Felipe Contreras
2012-02-05 6:17 ` Jonathan Nieder
2012-02-06 21:18 ` Felipe Contreras
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=20120204233909.GA1366@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=b.gianfo@gmail.com \
--cc=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=junkio@cox.net \
--cc=marius@trolltech.com \
/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).