Re: [PATCH 04/10] config: avoid segfault when parsing command-line config
- From
Jeff King <peff@peff.net>
- Date
- Jun 13, 2011, 19:22 UTC
- Message-ID
- <20110613192200.GF17845@sigill.intra.peff.net>
- In-Reply-To
- <7vhb7tod01.fsf@alter.siamese.dyndns.org>
On Mon, Jun 13, 2011 at 10:30:22AM -0700, Junio C Hamano wrote:
Show 9 quoted lines
> > + if (!pair[0])
> > + return error("bogus config parameter: %s", text);
>
> This feels wrong.
>
> Asking strbuf_split() to split a string "foo" with "=" delimiter would
> give you one element array ("foo", NULL), a string "fo" would give you
> ("fo", NULL), and a string "f" would give you ("f", NULL). Shouldn't we
> get ("", NULL) if we ask it to split ""?Yeah, I was making the assumption that strbuf_split was not bugging, and coding to its output. But I think you are right, that it is simply returning bogus output.
-Peff