{"thread":{"id":"3932","subject":"[PATCH] fix pack-object buffer size","startedAt":"2006-04-20T21:25:37Z","lastAt":"2006-04-20T21:25:37Z","messageCount":1,"participants":["Nicolas Pitre"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"18948","messageId":"Pine.LNX.4.64.0604201718000.2215@localhost.localdomain","threadId":"3932","inReplyTo":null,"subject":"[PATCH] fix pack-object buffer size","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2006-04-20T21:25:37Z","receivedAt":"2006-04-20T21:25:37Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"The input line has 40 _chars_ of sha1 and no 20 _bytes_. It should also \naccount for the space before the pathname, and the terminating \\n and \\0.\n\nSigned-off-by: Nicolas Pitre <nico@cam.org>\n---\n\nI doubt anyone has ever used a repository with paths long enough to hit \nthe limit, but better make it right nevertheless.\n\ndiff --git a/pack-objects.c b/pack-objects.c\nindex 09f4f2c..3c2767b 100644\n--- a/pack-objects.c\n+++ b/pack-objects.c\n@@ -1231,7 +1231,7 @@ static void setup_progress_signal(void)\n int main(int argc, char **argv)\n {\n \tSHA_CTX ctx;\n-\tchar line[PATH_MAX + 20];\n+\tchar line[40 + 1 + PATH_MAX + 2];\n \tint window = 10, depth = 10, pack_to_stdout = 0;\n \tstruct object_entry **list;\n \tint num_preferred_base = 0;\n"}]}