* [PATCH] bundle: verify arguments more strictly
@ 2015-05-08 7:49 Patrick Steinhardt
2015-05-08 8:02 ` [PATCH v2] " Patrick Steinhardt
2015-05-08 8:11 ` [PATCH] " Johannes Schindelin
0 siblings, 2 replies; 4+ messages in thread
From: Patrick Steinhardt @ 2015-05-08 7:49 UTC (permalink / raw)
To: git; +Cc: Patrick Steinhardt
The `verify` and `create` subcommands of the bundle builtin do
not properly verify the command line arguments that have been
passed in. While the `verify` subcommand accepts an arbitrary
amount of ignored arguments the `create` subcommand does not
complain about being passed too few arguments, resulting in a
bogus call to `git rev-list`. Fix these errors by verifying that
the correct amount of arguments has been passed in.
---
builtin/bundle.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/builtin/bundle.c b/builtin/bundle.c
index 92a8a60..4883a43 100644
--- a/builtin/bundle.c
+++ b/builtin/bundle.c
@@ -42,6 +42,10 @@ int cmd_bundle(int argc, const char **argv, const char *prefix)
if (!strcmp(cmd, "verify")) {
close(bundle_fd);
+ if (argc != 1) {
+ usage(builtin_bundle_usage);
+ return 1;
+ }
if (verify_bundle(&header, 1))
return 1;
fprintf(stderr, _("%s is okay\n"), bundle_file);
@@ -52,6 +56,10 @@ int cmd_bundle(int argc, const char **argv, const char *prefix)
return !!list_bundle_refs(&header, argc, argv);
}
if (!strcmp(cmd, "create")) {
+ if (argc < 2) {
+ usage(builtin_bundle_usage);
+ return 1;
+ }
if (!startup_info->have_repository)
die(_("Need a repository to create a bundle."));
return !!create_bundle(&header, bundle_file, argc, argv);
--
2.4.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2] bundle: verify arguments more strictly
2015-05-08 7:49 [PATCH] bundle: verify arguments more strictly Patrick Steinhardt
@ 2015-05-08 8:02 ` Patrick Steinhardt
2015-05-08 8:12 ` Johannes Schindelin
2015-05-08 8:11 ` [PATCH] " Johannes Schindelin
1 sibling, 1 reply; 4+ messages in thread
From: Patrick Steinhardt @ 2015-05-08 8:02 UTC (permalink / raw)
To: git; +Cc: Patrick Steinhardt
The `verify` and `create` subcommands of the bundle builtin do
not properly verify the command line arguments that have been
passed in. While the `verify` subcommand accepts an arbitrary
amount of ignored arguments the `create` subcommand does not
complain about being passed too few arguments, resulting in a
bogus call to `git rev-list`. Fix these errors by verifying that
the correct amount of arguments has been passed in.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Added missing Signed-off-by.
builtin/bundle.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/builtin/bundle.c b/builtin/bundle.c
index 92a8a60..4883a43 100644
--- a/builtin/bundle.c
+++ b/builtin/bundle.c
@@ -42,6 +42,10 @@ int cmd_bundle(int argc, const char **argv, const char *prefix)
if (!strcmp(cmd, "verify")) {
close(bundle_fd);
+ if (argc != 1) {
+ usage(builtin_bundle_usage);
+ return 1;
+ }
if (verify_bundle(&header, 1))
return 1;
fprintf(stderr, _("%s is okay\n"), bundle_file);
@@ -52,6 +56,10 @@ int cmd_bundle(int argc, const char **argv, const char *prefix)
return !!list_bundle_refs(&header, argc, argv);
}
if (!strcmp(cmd, "create")) {
+ if (argc < 2) {
+ usage(builtin_bundle_usage);
+ return 1;
+ }
if (!startup_info->have_repository)
die(_("Need a repository to create a bundle."));
return !!create_bundle(&header, bundle_file, argc, argv);
--
2.4.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] bundle: verify arguments more strictly
2015-05-08 7:49 [PATCH] bundle: verify arguments more strictly Patrick Steinhardt
2015-05-08 8:02 ` [PATCH v2] " Patrick Steinhardt
@ 2015-05-08 8:11 ` Johannes Schindelin
1 sibling, 0 replies; 4+ messages in thread
From: Johannes Schindelin @ 2015-05-08 8:11 UTC (permalink / raw)
To: Patrick Steinhardt; +Cc: git
Hi Patrick,
On 2015-05-08 09:49, Patrick Steinhardt wrote:
> The `verify` and `create` subcommands of the bundle builtin do
> not properly verify the command line arguments that have been
> passed in. While the `verify` subcommand accepts an arbitrary
> amount of ignored arguments the `create` subcommand does not
> complain about being passed too few arguments, resulting in a
> bogus call to `git rev-list`. Fix these errors by verifying that
> the correct amount of arguments has been passed in.
Good catch. But please sign off your patch [*1*]
Other than that...
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Ciao,
Johannes
Footnote *1*: Here is why you need to sign off on your patches: https://github.com/git/git/blob/v2.3.5/Documentation/SubmittingPatches#L234-L286
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-05-08 8:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-08 7:49 [PATCH] bundle: verify arguments more strictly Patrick Steinhardt
2015-05-08 8:02 ` [PATCH v2] " Patrick Steinhardt
2015-05-08 8:12 ` Johannes Schindelin
2015-05-08 8:11 ` [PATCH] " Johannes Schindelin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).