Re: [PATCH 1/3] blame: fix email output with mailmap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]