Re: problem with http clone/pull

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <junkio@xxxxxxx> writes:

> I've seen this "last character of hostname dropped" symptom
> mentioned on the #git channel long time ago, but I do not
> remember if somebody figured out what the problem was.  I know
> that nobody did a patch to specifically fix it.

Perhaps this would fix it?

I am at work now and I haven't looked at the logic aruond it
too deeply (e.g. I do not know if this breaks the relative
alternate or http specific cases, nor the same or similar
breakages were there in these other cases in the original code
to begin with)

---

diff --git a/http-fetch.c b/http-fetch.c
index fac1760..d870390 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -559,7 +559,13 @@ static void process_alternates_response(
 			char *target = NULL;
 			char *path;
 			if (data[i] == '/') {
-				serverlen = strchr(base + 8, '/') - base;
+				/* This counts
+				 * http://git.host/pub/scm/linux.git
+				 * 1234567----here^
+				 * so strcpy(dst, base, serverlen) will
+				 * copy up to "...git.host/"
+				 */
+				serverlen = strchr(base + 7, '/') - base;
 				okay = 1;
 			} else if (!memcmp(data + i, "../", 3)) {
 				i += 3;
@@ -586,7 +592,7 @@ static void process_alternates_response(
 			/* skip 'objects' at end */
 			if (okay) {
 				target = xmalloc(serverlen + posn - i - 6);
-				strlcpy(target, base, serverlen);
+				memcpy(target, base, serverlen);
 				strlcpy(target + serverlen, data + i, posn - i - 6);
 				if (get_verbosely)
 					fprintf(stderr,

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]