From: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
To: Linus Torvalds <torvalds@osdl.org>, Petr Baudis <pasky@ucw.cz>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] git-tar-tree: Lift path length limit
Date: Sat, 7 May 2005 02:57:06 +0200 [thread overview]
Message-ID: <20050507005706.GA6093@lsrfire.ath.cx> (raw)
In-Reply-To: <20050507002527.GA5082@lsrfire.ath.cx>
On Sat, May 07, 2005 at 02:25:27AM +0200, Rene Scharfe wrote:
> Last minute patch?
This leaks memory. D'oh!
Petr, would you add the (hopefully) fixed version below to your tree now
that Linus is on vacation? (Patch applies to tip of GIT tree.)
Thanks,
Rene
Lift path length limits from git-tar-tree.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
---
commit d36797f64ee0431e6a73aa1c77a7fe7c18b6ce9f
tree ab8e6967a08ac343b69b527f663e6a9722fcea08
parent bf60144c0ab50e88c0086a90c5cb35b81613ad14
author Rene Scharfe <rene.scharfe@lsrfire.ath.cx> 1115322098 +0200
committer Rene Scharfe <rene.scharfe@lsrfire.ath.cx> 1115322098 +0200
Index: tar-tree.c
===================================================================
--- 8ef25a2788d6c225641a3040622b82c364f987b8/tar-tree.c (mode:100644 sha1:9d9bd7be98502f64e4a643ef0973182f3483251e)
+++ ab8e6967a08ac343b69b527f663e6a9722fcea08/tar-tree.c (mode:100644 sha1:8b0d75bd2cf12a531aee3d51e59a8ac8102ba6be)
@@ -212,7 +212,7 @@
const char *path, unsigned int namelen,
void *content, unsigned int contentsize)
{
- char *p;
+ char *buffer, *p;
unsigned int pathlen, size, linkpathlen = 0;
size = pathlen = extended_header_len("path", namelen);
@@ -220,18 +220,19 @@
linkpathlen = extended_header_len("linkpath", contentsize);
size += linkpathlen;
}
- if (size > RECORDSIZE)
- die("tar-tree: extended header too big, wtf?");
write_header(NULL, TYPEFLAG_EXT_HEADER, NULL, NULL, headerfilename,
0100600, NULL, size);
- p = get_record();
+ buffer = p = malloc(size);
+ if (!buffer)
+ die("git-tar-tree: %s", strerror(errno));
append_extended_header_prefix(&p, pathlen, "path");
append_path(&p, is_dir, basepath, prefix, path);
append_char(&p, '\n');
if (flags & EXT_HEADER_LINKPATH)
append_extended_header(&p, "linkpath", content, contentsize);
- write_if_needed();
+ write_blocked(buffer, size);
+ free(buffer);
}
static void write_global_extended_header(const char *sha1)
@@ -269,9 +270,7 @@
}
namelen = path_len(S_ISDIR(mode), basepath, prefix, path);
- if (namelen > 500)
- die("tar-tree: name too log of object %s\n", sha1_to_hex(sha1));
- else if (namelen > 100)
+ if (namelen > 100)
ext_header |= EXT_HEADER_PATH;
if (typeflag == TYPEFLAG_LNK && size > 100)
ext_header |= EXT_HEADER_LINKPATH;
next prev parent reply other threads:[~2005-05-07 0:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-07 0:25 [PATCH] git-tar-tree: Lift path length limit Rene Scharfe
2005-05-07 0:57 ` Rene Scharfe [this message]
2005-05-07 12:09 ` Petr Baudis
2005-05-07 18:42 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050507005706.GA6093@lsrfire.ath.cx \
--to=rene.scharfe@lsrfire.ath.cx \
--cc=git@vger.kernel.org \
--cc=pasky@ucw.cz \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).