summaryrefslogtreecommitdiff
path: root/credential.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-04-22 20:43:01 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-04-22 20:43:01 (GMT)
commita397e9c236b0ff56eb15f32a2a41c852b1e5dd3b (patch)
treef9f4f596a2e9a5647684c9d8086b05859dc7f614 /credential.c
parentd6d561db1c0a14e8b89149694c0c662096c5fc9d (diff)
parent4c5971e18a181c68aec03262fb467cb5d21a5b0d (diff)
downloadgit-a397e9c236b0ff56eb15f32a2a41c852b1e5dd3b.zip
git-a397e9c236b0ff56eb15f32a2a41c852b1e5dd3b.tar.gz
git-a397e9c236b0ff56eb15f32a2a41c852b1e5dd3b.tar.bz2
Merge branch 'jk/credential-parsing-end-of-host-in-URL'
Parsing of URL for the credential helper has been corrected. * jk/credential-parsing-end-of-host-in-URL: credential: treat "?" and "#" in URLs as end of host
Diffstat (limited to 'credential.c')
-rw-r--r--credential.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/credential.c b/credential.c
index 108d9e1..064e25e 100644
--- a/credential.c
+++ b/credential.c
@@ -399,7 +399,14 @@ int credential_from_url_gently(struct credential *c, const char *url,
cp = proto_end + 3;
at = strchr(cp, '@');
colon = strchr(cp, ':');
- slash = strchrnul(cp, '/');
+
+ /*
+ * A query or fragment marker before the slash ends the host portion.
+ * We'll just continue to call this "slash" for simplicity. Notably our
+ * "trim leading slashes" part won't skip over this part of the path,
+ * but that's what we'd want.
+ */
+ slash = cp + strcspn(cp, "/?#");
if (!at || slash <= at) {
/* Case (1) */