Merge branch 'rs/pretty-safety'
* rs/pretty-safety: Make "--pretty=format" parser a bit more careful.
This commit is contained in:
commit
49e6be571e
4
pretty.c
4
pretty.c
@ -412,7 +412,7 @@ static void parse_commit_header(struct format_commit_context *context)
|
|||||||
if (i == eol) {
|
if (i == eol) {
|
||||||
state++;
|
state++;
|
||||||
/* strip empty lines */
|
/* strip empty lines */
|
||||||
while (msg[eol + 1] == '\n')
|
while (msg[eol] == '\n' && msg[eol + 1] == '\n')
|
||||||
eol++;
|
eol++;
|
||||||
} else if (!prefixcmp(msg + i, "author ")) {
|
} else if (!prefixcmp(msg + i, "author ")) {
|
||||||
context->author.off = i + 7;
|
context->author.off = i + 7;
|
||||||
@ -425,6 +425,8 @@ static void parse_commit_header(struct format_commit_context *context)
|
|||||||
context->encoding.len = eol - i - 9;
|
context->encoding.len = eol - i - 9;
|
||||||
}
|
}
|
||||||
i = eol;
|
i = eol;
|
||||||
|
if (!msg[i])
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
context->body_off = i;
|
context->body_off = i;
|
||||||
context->commit_header_parsed = 1;
|
context->commit_header_parsed = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user