From: Jeff King <peff@peff.net>
To: Jens Lehmann <Jens.Lehmann@web.de>
Cc: Jharrod LaFon <jlafon@eyesopen.com>,
"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCH] Git segmentation faults if submodule path is empty.
Date: Fri, 16 Aug 2013 09:14:06 -0400 [thread overview]
Message-ID: <20130816131406.GC20138@sigill.intra.peff.net> (raw)
In-Reply-To: <20130816130957.GB20138@sigill.intra.peff.net>
On Fri, Aug 16, 2013 at 09:09:58AM -0400, Jeff King wrote:
> > > - if (parse_config_key(var, "submodule", &name, &namelen, &key) < 0 || !name)
> > > + if (parse_config_key(var, "submodule", &name, &namelen, &key) < 0 || !name || !value)
> > > return 0;
>
> I think this is also the wrong place to make the check, anyway. It is
> saying that all values of submodule.X.Y must be non-NULL. But that is
> not true. The submodule.X.fetchRecurseSubmodules option can be a
> boolean, and:
>
> [submodule "foo"]
> fetchRecurseSubmodules
>
> is perfectly valid (and is broken by this patch).
IOW, I think this is the right fix:
diff --git a/submodule.c b/submodule.c
index 3f0a3f9..c0f93c2 100644
--- a/submodule.c
+++ b/submodule.c
@@ -134,6 +134,9 @@ int parse_submodule_config_option(const char *var, const char *value)
return 0;
if (!strcmp(key, "path")) {
+ if (!value)
+ return config_error_nonbool(var);
+
config = unsorted_string_list_lookup(&config_name_for_path, value);
if (config)
free(config->util);
@@ -151,6 +154,9 @@ int parse_submodule_config_option(const char *var, const char *value)
} else if (!strcmp(key, "ignore")) {
char *name_cstr;
+ if (!value)
+ return config_error_nonbool(var);
+
if (strcmp(value, "untracked") && strcmp(value, "dirty") &&
strcmp(value, "all") && strcmp(value, "none")) {
warning("Invalid parameter \"%s\" for config option \"submodule.%s.ignore\"", value, var);
And new options, as they are added, must decide whether they are boolean
or not (and check !value as appropriate).
-Peff
next prev parent reply other threads:[~2013-08-16 13:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-16 1:51 [PATCH] Git segmentation faults if submodule path is empty Jharrod LaFon
2013-08-16 6:48 ` Jens Lehmann
2013-08-16 13:09 ` Jeff King
2013-08-16 13:14 ` Jeff King [this message]
2013-08-16 15:12 ` Jharrod LaFon
2013-08-16 17:59 ` Jharrod LaFon
2013-08-16 20:52 ` Jeff King
2013-08-19 16:26 ` Jharrod LaFon
2013-08-19 18:56 ` Junio C Hamano
2013-08-19 20:48 ` Jeff King
[not found] ` <30EC6002-1044-41E0-8700-1F210A6CA882@eyesopen.com>
2013-08-19 20:54 ` Junio C Hamano
2013-08-20 0:26 ` Jharrod LaFon
2013-08-16 7:50 ` Thomas Rast
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130816131406.GC20138@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=Jens.Lehmann@web.de \
--cc=git@vger.kernel.org \
--cc=jlafon@eyesopen.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox