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

[PATCH] fix pack-object buffer size

From
Nicolas Pitre <nico@cam.org>
Date
Apr 20, 2006, 21:25 UTC
Message-ID
<Pine.LNX.4.64.0604201718000.2215@localhost.localdomain>

The input line has 40 _chars_ of sha1 and no 20 _bytes_. It should also account for the space before the pathname, and the terminating \n and \0.

Signed-off-by: Nicolas Pitre <nico@cam.org>
---

I doubt anyone has ever used a repository with paths long enough to hit the limit, but better make it right nevertheless.

diff --git a/pack-objects.c b/pack-objects.c
index 09f4f2c..3c2767b 100644
--- a/pack-objects.c
+++ b/pack-objects.c
@@ -1231,7 +1231,7 @@ static void setup_progress_signal(void)
 int main(int argc, char **argv)
 {
 	SHA_CTX ctx;
-	char line[PATH_MAX + 20];
+	char line[40 + 1 + PATH_MAX + 2];
 	int window = 10, depth = 10, pack_to_stdout = 0;
 	struct object_entry **list;
 	int num_preferred_base = 0;
Message 1 of 1 in “fix pack-object buffer size”
  1. fix pack-object buffer sizeNicolas Pitre, Apr 20, 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.