{"thread":{"id":"39272","subject":"[PATCH] bundle: verify arguments more strictly","startedAt":"2015-05-08T07:49:01Z","lastAt":"2015-05-08T08:12:51Z","messageCount":4,"participants":["Patrick Steinhardt","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"260800","messageId":"1431071341-23363-1-git-send-email-ps@pks.im","threadId":"39272","inReplyTo":null,"subject":"[PATCH] bundle: verify arguments more strictly","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2015-05-08T07:49:01Z","receivedAt":"2015-05-08T07:49:01Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"The `verify` and `create` subcommands of the bundle builtin do\nnot properly verify the command line arguments that have been\npassed in. While the `verify` subcommand accepts an arbitrary\namount of ignored arguments the `create` subcommand does not\ncomplain about being passed too few arguments, resulting in a\nbogus call to `git rev-list`. Fix these errors by verifying that\nthe correct amount of arguments has been passed in.\n---\n builtin/bundle.c | 8 ++++++++\n 1 file changed, 8 insertions(+)\n\ndiff --git a/builtin/bundle.c b/builtin/bundle.c\nindex 92a8a60..4883a43 100644\n--- a/builtin/bundle.c\n+++ b/builtin/bundle.c\n@@ -42,6 +42,10 @@ int cmd_bundle(int argc, const char **argv, const char *prefix)\n \n \tif (!strcmp(cmd, \"verify\")) {\n \t\tclose(bundle_fd);\n+\t\tif (argc != 1) {\n+\t\t\tusage(builtin_bundle_usage);\n+\t\t\treturn 1;\n+\t\t}\n \t\tif (verify_bundle(&header, 1))\n \t\t\treturn 1;\n \t\tfprintf(stderr, _(\"%s is okay\\n\"), bundle_file);\n@@ -52,6 +56,10 @@ int cmd_bundle(int argc, const char **argv, const char *prefix)\n \t\treturn !!list_bundle_refs(&header, argc, argv);\n \t}\n \tif (!strcmp(cmd, \"create\")) {\n+\t\tif (argc < 2) {\n+\t\t\tusage(builtin_bundle_usage);\n+\t\t\treturn 1;\n+\t\t}\n \t\tif (!startup_info->have_repository)\n \t\t\tdie(_(\"Need a repository to create a bundle.\"));\n \t\treturn !!create_bundle(&header, bundle_file, argc, argv);\n-- \n2.4.0\n"},{"id":"260801","messageId":"1431072120-24245-1-git-send-email-ps@pks.im","threadId":"39272","inReplyTo":"1431071341-23363-1-git-send-email-ps@pks.im","subject":"[PATCH v2] bundle: verify arguments more strictly","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2015-05-08T08:02:00Z","receivedAt":"2015-05-08T08:02:00Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"The `verify` and `create` subcommands of the bundle builtin do\nnot properly verify the command line arguments that have been\npassed in. While the `verify` subcommand accepts an arbitrary\namount of ignored arguments the `create` subcommand does not\ncomplain about being passed too few arguments, resulting in a\nbogus call to `git rev-list`. Fix these errors by verifying that\nthe correct amount of arguments has been passed in.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n\nAdded missing Signed-off-by.\n\n builtin/bundle.c | 8 ++++++++\n 1 file changed, 8 insertions(+)\n\ndiff --git a/builtin/bundle.c b/builtin/bundle.c\nindex 92a8a60..4883a43 100644\n--- a/builtin/bundle.c\n+++ b/builtin/bundle.c\n@@ -42,6 +42,10 @@ int cmd_bundle(int argc, const char **argv, const char *prefix)\n \n \tif (!strcmp(cmd, \"verify\")) {\n \t\tclose(bundle_fd);\n+\t\tif (argc != 1) {\n+\t\t\tusage(builtin_bundle_usage);\n+\t\t\treturn 1;\n+\t\t}\n \t\tif (verify_bundle(&header, 1))\n \t\t\treturn 1;\n \t\tfprintf(stderr, _(\"%s is okay\\n\"), bundle_file);\n@@ -52,6 +56,10 @@ int cmd_bundle(int argc, const char **argv, const char *prefix)\n \t\treturn !!list_bundle_refs(&header, argc, argv);\n \t}\n \tif (!strcmp(cmd, \"create\")) {\n+\t\tif (argc < 2) {\n+\t\t\tusage(builtin_bundle_usage);\n+\t\t\treturn 1;\n+\t\t}\n \t\tif (!startup_info->have_repository)\n \t\t\tdie(_(\"Need a repository to create a bundle.\"));\n \t\treturn !!create_bundle(&header, bundle_file, argc, argv);\n-- \n2.4.0\n"},{"id":"260802","messageId":"239a633b6bbed03e92318322ce566295@www.dscho.org","threadId":"39272","inReplyTo":"1431071341-23363-1-git-send-email-ps@pks.im","subject":"Re: [PATCH] bundle: verify arguments more strictly","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2015-05-08T08:11:08Z","receivedAt":"2015-05-08T08:11:08Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Patrick,\n\nOn 2015-05-08 09:49, Patrick Steinhardt wrote:\n> The `verify` and `create` subcommands of the bundle builtin do\n> not properly verify the command line arguments that have been\n> passed in. While the `verify` subcommand accepts an arbitrary\n> amount of ignored arguments the `create` subcommand does not\n> complain about being passed too few arguments, resulting in a\n> bogus call to `git rev-list`. Fix these errors by verifying that\n> the correct amount of arguments has been passed in.\n\nGood catch. But please sign off your patch [*1*]\n\nOther than that...\nAcked-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nCiao,\nJohannes\n\nFootnote *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\n"},{"id":"260803","messageId":"843faff92f28b479688cbc1e0dffa38d@www.dscho.org","threadId":"39272","inReplyTo":"1431072120-24245-1-git-send-email-ps@pks.im","subject":"Re: [PATCH v2] bundle: verify arguments more strictly","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2015-05-08T08:12:51Z","receivedAt":"2015-05-08T08:12:51Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Patrick,\n\nOn 2015-05-08 10:02, Patrick Steinhardt wrote:\n\n> Added missing Signed-off-by.\n\nHah, mid-air collision ;-)\n\nStill: ACK!\n\nCiao,\nJohannes\n"}]}