Skip to content

Commit

Permalink
Merge branch 'rs/pretty-safety'
Browse files Browse the repository at this point in the history
* rs/pretty-safety:
  Make "--pretty=format" parser a bit more careful.
  • Loading branch information
Junio C Hamano committed Dec 27, 2007
2 parents e25cfae + 7ed0988 commit 49e6be5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pretty.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ static void parse_commit_header(struct format_commit_context *context)
if (i == eol) {
state++;
/* strip empty lines */
while (msg[eol + 1] == '\n')
while (msg[eol] == '\n' && msg[eol + 1] == '\n')
eol++;
} else if (!prefixcmp(msg + i, "author ")) {
context->author.off = i + 7;
Expand All @@ -425,6 +425,8 @@ static void parse_commit_header(struct format_commit_context *context)
context->encoding.len = eol - i - 9;
}
i = eol;
if (!msg[i])
break;
}
context->body_off = i;
context->commit_header_parsed = 1;
Expand Down

0 comments on commit 49e6be5

Please sign in to comment.