Skip to content

Commit 50a01cc

Browse files
rscharfegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c3808ca commit 50a01cc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

commit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,8 +1354,8 @@ static struct commit_extra_header *read_commit_extra_header_lines(
13541354
strbuf_reset(&buf);
13551355
it = NULL;
13561356

1357-
eof = strchr(line, ' ');
1358-
if (next <= eof)
1357+
eof = memchr(line, ' ', next - line);
1358+
if (!eof)
13591359
eof = next;
13601360

13611361
if (standard_header_field(line, eof - line) ||

0 commit comments

Comments
 (0)