Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-12-27 04:52:40 +0300
committerJunio C Hamano <gitster@pobox.com>2007-12-27 04:52:40 +0300
commit49e6be571ecbcc3884bdd2262d974ec9ac051c49 (patch)
treed6ffb5c6a627c1b63fe1ef162770f3c57616d3c5
parente25cfae6677423d05a81c0862f58d3319141794c (diff)
parent7ed0988adc0a3cb3f103c105af387e3ac48eea61 (diff)
Merge branch 'rs/pretty-safety'
* rs/pretty-safety: Make "--pretty=format" parser a bit more careful.
-rw-r--r--pretty.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/pretty.c b/pretty.c
index 9db75b4e4f..5b1078beb6 100644
--- a/pretty.c
+++ b/pretty.c
@@ -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;
@@ -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;