Thread (5 messages) flat view 5 messages, 3 authors, 2016-06-15

Re: [PATCH v2] rev-parse: Check argc before using argv[i+1]

From: Johannes Sixt <hidden>
Date: 2016-06-15 22:59:46

Possibly related (same subject, not in this thread)

Am 28.01.2014 22:21, schrieb David Sharp:
quoted hunk ↗ jump to hunk
@@ -738,9 +740,12 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
 				continue;
 			}
 			if (!strcmp(arg, "--resolve-git-dir")) {
-				const char *gitdir = resolve_gitdir(argv[i+1]);
+				const char *gitdir = argv[++i];
 				if (!gitdir)
-					die("not a gitdir '%s'", argv[i+1]);
+					die("--resolve-git-dir requires an argument");
+				gitdir = resolve_gitdir(gitdir);
+				if (!gitdir)
+					die("not a gitdir '%s'", argv[i]);
 				puts(gitdir);
 				continue;
 			}
In this hunk, I don't see where the old code incremented i for the
argument. Was this another bug lurking that is fixed now?

-- Hannes
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help