Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
git-format-patch: do not crash with format.headers without value.
author
Junio C Hamano
<junkio@cox.net>
Wed, 17 Jan 2007 19:13:02 +0000
(11:13 -0800)
committer
Junio C Hamano
<junkio@cox.net>
Wed, 17 Jan 2007 20:03:50 +0000
(12:03 -0800)
An incorrect config file can say:
[format]
headers
and crash the parsing.
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-log.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
03eeaea
)
diff --git
a/builtin-log.c
b/builtin-log.c
index 7397a5af07c1bd1889d5c0bc2959060401f48829..1cd9d3f76834b40eb217cbb36784b85d5d076e3a 100644
(file)
--- a/
builtin-log.c
+++ b/
builtin-log.c
@@
-202,7
+202,11
@@
static const char *fmt_patch_suffix = ".txt";
static int git_format_config(const char *var, const char *value)
{
if (!strcmp(var, "format.headers")) {
static int git_format_config(const char *var, const char *value)
{
if (!strcmp(var, "format.headers")) {
- int len = strlen(value);
+ int len;
+
+ if (!value)
+ die("format.headers without value");
+ len = strlen(value);
extra_headers_size += len + 1;
extra_headers = xrealloc(extra_headers, extra_headers_size);
extra_headers[extra_headers_size - len - 1] = 0;
extra_headers_size += len + 1;
extra_headers = xrealloc(extra_headers, extra_headers_size);
extra_headers[extra_headers_size - len - 1] = 0;