From: René Scharfe Date: Sat, 25 Feb 2017 19:21:52 +0000 (+0100) Subject: commit: be more precise when searching for headers X-Git-Tag: v2.12.2~13^2~1 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/50a01cc48c9a46fe75e4a014fb7847c2f4482406?ds=inline;hp=--cc commit: be more precise when searching for headers 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 Signed-off-by: Junio C Hamano --- 50a01cc48c9a46fe75e4a014fb7847c2f4482406 diff --git a/commit.c b/commit.c index aada266f9a..ee49c1ce25 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) ||