diff options
author | Tanay Abhra <tanayabh@gmail.com> | 2014-08-04 07:41:15 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-08-04 12:12:25 -0700 |
commit | a26bc613a64ac2c7ee69a50675e61b004a26382d (patch) | |
tree | 16eb05b8b6b7257133b8a08a990ce1dfc1893331 /pretty.c | |
parent | d31f3ad23dd1aee3c3e1015a43b02b995c01a9a1 (diff) | |
download | git-a26bc613a64ac2c7ee69a50675e61b004a26382d.tar.gz |
pretty.c: make git_pretty_formats_config return -1 on git_config_string failureta/pretty-parse-config
`git_pretty_formats_config()` continues without checking git_config_string's
return value which can lead to a SEGFAULT. Instead return -1 when
git_config_string fails signalling `git_config()` to die printing the location
of the erroneous variable.
Signed-off-by: Tanay Abhra <tanayabh@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pretty.c')
-rw-r--r-- | pretty.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -66,7 +66,9 @@ static int git_pretty_formats_config(const char *var, const char *value, void *c commit_format->name = xstrdup(name); commit_format->format = CMIT_FMT_USERFORMAT; - git_config_string(&fmt, var, value); + if (git_config_string(&fmt, var, value)) + return -1; + if (starts_with(fmt, "format:") || starts_with(fmt, "tformat:")) { commit_format->is_tformat = fmt[0] == 't'; fmt = strchr(fmt, ':') + 1; |