diff --git a/connect.c b/connect.c
index 06d279e37ca73b6128479a990b9cd5dbd7cb1317..3d5c4ab7550d3665a4b24265c0c052e3c7e00231 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;
}