Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2011-06-09 19:52:43 +0400
committerJunio C Hamano <gitster@pobox.com>2011-06-22 22:24:51 +0400
commitc5d6350bdc8d0d8bd4bd1aa0273313e71cd548f6 (patch)
tree1a2a1f3d095ba519e1f3ef019d8cce217117fafb /config.c
parent1c2c9bee1bad9a4133a934d04c32b033cc16c8aa (diff)
config: avoid segfault when parsing command-line config
We already check for an empty key on the left side of an equals, but we would segfault if there was no content at all. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'config.c')
-rw-r--r--config.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/config.c b/config.c
index 2567b546a3..9939f65d9e 100644
--- a/config.c
+++ b/config.c
@@ -46,6 +46,8 @@ static int git_config_parse_parameter(const char *text,
struct strbuf **pair;
strbuf_addstr(&tmp, text);
pair = strbuf_split_max(&tmp, '=', 2);
+ if (!pair[0])
+ return error("bogus config parameter: %s", text);
if (pair[0]->len && pair[0]->buf[pair[0]->len - 1] == '=')
strbuf_setlen(pair[0], pair[0]->len - 1);
strbuf_trim(pair[0]);