git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "René Scharfe" <l.s.r@web.de>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH 1/2] commit: be more precise when searching for headers
Date: Mon, 27 Feb 2017 11:18:30 -0800	[thread overview]
Message-ID: <xmqq8torxx15.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <23989e76-24ba-90a4-91a9-9f66bfccb7c9@web.de> ("René Scharfe"'s message of "Sat, 25 Feb 2017 20:21:52 +0100")

René Scharfe <l.s.r@web.de> writes:

> Search for a space character only within the current line in
> read_commit_extra_header_lines() instead of searching in the whole
> buffer (and possibly beyond, if it's not NUL-terminated) and then
> discarding any results after the end of the current line.
>
> Signed-off-by: Rene Scharfe <l.s.r@web.de>
> ---
>  commit.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Makes sense.

> diff --git a/commit.c b/commit.c
> index 2cf85158b4..173c6d3818 100644
> --- a/commit.c
> +++ b/commit.c
> @@ -1354,8 +1354,8 @@ static struct commit_extra_header *read_commit_extra_header_lines(
>  		strbuf_reset(&buf);
>  		it = NULL;
>  
> -		eof = strchr(line, ' ');
> -		if (next <= eof)
> +		eof = memchr(line, ' ', next - line);
> +		if (!eof)
>  			eof = next;
>  
>  		if (standard_header_field(line, eof - line) ||

      parent reply	other threads:[~2017-02-27 19:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-25 19:21 [PATCH 1/2] commit: be more precise when searching for headers René Scharfe
2017-02-25 19:27 ` [PATCH 2/2] commit: don't check for space twice when looking for header René Scharfe
2017-02-25 20:15   ` Jeff King
2017-02-25 21:39     ` René Scharfe
2017-02-25 21:51       ` Jeff King
2017-02-27 22:27   ` Jakub Narębski
2017-02-27 22:54     ` René Scharfe
2017-02-25 20:12 ` [PATCH 1/2] commit: be more precise when searching for headers Jeff King
2017-02-27 19:18 ` Junio C Hamano [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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=xmqq8torxx15.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=l.s.r@web.de \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).