@matheusbsbs / matheus-bagliano / commits / f53423b0e0
Fork 0

git-fetch: Don't trigger a bus error when given the refspec "tag"

When git-fetch encounters the refspec "tag" it assumes that the next argument will be a tag name. If there is no next argument, it should die gracefully instead of erroring. Signed-off-by: Kevin Ballard <kevin@sb.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Kevin Ballard committed Apr 5, 2008 at 14:28 UTC f53423b0e09d0de9584f72ac298bdfdc9e886d73
1 file changed +2
builtin-fetch.c
+2
@@ -637,6 +637,8 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
637 if (!strcmp(argv[i], "tag")) {
638 char *ref;
639 i++;
640 + if (i >= argc)
641 + die("You need to specify a tag name.");
642 ref = xmalloc(strlen(argv[i]) * 2 + 22);
643 strcpy(ref, "refs/tags/");
644 strcat(ref, argv[i]);