git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] send pack remove remote reference limit

From
Andy Whitcroft <apw@shadowen.org>
Date
Sep 5, 2006, 19:00 UTC
Message-ID
<20060905190017.GA24102@shadowen.org>
In-Reply-To
<7v64g2i9p8.fsf@assigned-by-dhcp.cox.net>
send-pack: remove remote reference limit

When build a pack for a push we query the remote copy for existant heads. These are used to prune unnecessary objects from the pack. As we receive the remote references in get_remote_heads() we validate the reference names via check_ref() which includes a length check; rejecting those >45 characters in size.

This is a miss converted change, it was originally designed to reject messages which were less than 45 characters in length (a 40 character sha1 and refs/) to prevent comparing unitialised memory. check_ref() now gets the raw length so check for at least 5 characters.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
---
diff --git a/connect.c b/connect.c
index e501ccc..371aea1 100644
--- a/connect.c
+++ b/connect.c
@@ -17,7 +17,7 @@ static int check_ref(const char *name, i
 	if (!flags)
 		return 1;
 
-	if (len > 45 || memcmp(name, "refs/", 5))
+	if (len < 5 || memcmp(name, "refs/", 5))
 		return 0;
 
 	/* Skip the "refs/" part */
Previous: Junio C Hamano
Message 3 of 3 in “remote_get_heads: reference length limit”
  1. Andy WhitcroftSep 5, 2006
  2. Junio C HamanoSep 5, 2006
  3. send pack remove remote reference limitAndy Whitcroft, Sep 5, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.