From d7fb91c69dc347c53b0d9830b13fdadf217a78f1 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 17 Jan 2007 11:13:02 -0800 Subject: [PATCH] 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 --- builtin-log.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/builtin-log.c b/builtin-log.c index 7397a5af0..1cd9d3f76 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; -- 2.30.2