Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Make "--pretty=format" parser a bit more careful.
author
René Scharfe
<rene.scharfe@lsrfire.ath.cx>
Thu, 20 Dec 2007 12:20:15 +0000
(13:20 +0100)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 27 Dec 2007 01:52:32 +0000
(17:52 -0800)
When a commit message that does not have a terminating LF is
read in and the memory that was allocated to read it happens to
have a LF immediately after that, the code was not careful and
went past the terminating NUL.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pretty.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
cc21682
)
diff --git
a/pretty.c
b/pretty.c
index 9db75b4e4f24b28ca44d65750ec6ebb4feb99eee..5b1078beb6b27f08b196d0e35b4acfb72df643b7 100644
(file)
--- 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;