diff --git a/connect.c b/connect.c
index 8b1e9935a85b639f6c48298d07299f72bceaad29..aee78ff2066bee0cc4ddecdba7454c6dad783e39 100644 (file)
--- a/connect.c
+++ b/connect.c
continue;
if (nr_match && !path_match(name, nr_match, match))
continue;
- ref = alloc_ref(len - 40);
+ ref = alloc_ref(name_len + 1);
hashcpy(ref->old_sha1, old_sha1);
- memcpy(ref->name, buffer + 41, len - 40);
+ memcpy(ref->name, buffer + 41, name_len + 1);
*list = ref;
list = &ref->next;
}