summaryrefslogtreecommitdiff
path: root/builtin-log.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-01-17 11:13:02 -0800
committerJunio C Hamano <junkio@cox.net>2007-01-17 12:03:50 -0800
commitd7fb91c69dc347c53b0d9830b13fdadf217a78f1 (patch)
tree15f4fd63f8804ccef011d442f554cc425dcf50eb /builtin-log.c
parent03eeaeaea57485e288dfecc37b120b074d6e92de (diff)
downloadgit-d7fb91c69dc347c53b0d9830b13fdadf217a78f1.tar.gz
git-format-patch: do not crash with format.headers without value.
An incorrect config file can say: [format] headers and crash the parsing. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-log.c')
-rw-r--r--builtin-log.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/builtin-log.c b/builtin-log.c
index 7397a5af07..1cd9d3f768 100644
--- 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")) {
- 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;