Re: [PATCH] bundle: don't segfault on "git bundle <subcmd>"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ævar Arnfjörð Bjarmason  <avarab@xxxxxxxxx> writes:

> As an aside, this could be safely squashed into this, but let's not do
> that for this minimal segfault fix, as it's an unrelated refactoring:
>
> 	--- a/builtin/bundle.c
> 	+++ b/builtin/bundle.c
> 	@@ -55,13 +55,12 @@ static int parse_options_cmd_bundle(int argc,
> 	 		const char * const usagestr[],
> 	 		const struct option options[],
> 	 		char **bundle_file) {
> 	-	int newargc;
> 	-	newargc = parse_options(argc, argv, NULL, options, usagestr,
> 	+	argc = parse_options(argc, argv, NULL, options, usagestr,
> 	 			     PARSE_OPT_STOP_AT_NON_OPTION);
> 	-	if (!newargc)
> 	+	if (!argc)
> 	 		usage_with_options(usagestr, options);
> 	 	*bundle_file = prefix_filename(prefix, argv[0]);
> 	-	return newargc;
> 	+	return argc;
> 	 }

That would actually make the intent much clearer and if the code
were written to update argc instead of introducing a separate
varilable, this bug would not have happened.

Thanks, will queue (without the clean-up at least for now).



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux