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>
This commit is contained in:
parent
03eeaeaea5
commit
d7fb91c69d
@ -202,7 +202,11 @@ static const char *fmt_patch_suffix = ".txt";
|
|||||||
static int git_format_config(const char *var, const char *value)
|
static int git_format_config(const char *var, const char *value)
|
||||||
{
|
{
|
||||||
if (!strcmp(var, "format.headers")) {
|
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_size += len + 1;
|
||||||
extra_headers = xrealloc(extra_headers, extra_headers_size);
|
extra_headers = xrealloc(extra_headers, extra_headers_size);
|
||||||
extra_headers[extra_headers_size - len - 1] = 0;
|
extra_headers[extra_headers_size - len - 1] = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user