git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] commit: be more precise when searching for headers
@ 2017-02-25 19:21 René Scharfe
  2017-02-25 19:27 ` [PATCH 2/2] commit: don't check for space twice when looking for header René Scharfe
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: René Scharfe @ 2017-02-25 19:21 UTC (permalink / raw)
  To: Git List; +Cc: Junio C Hamano

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(-)

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) ||
-- 
2.12.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-02-27 22:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).