git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
To: Daniel Barkalow <barkalow@iabervon.org>, Junio C Hamano <junkio@cox.net>
Cc: Johan Herland <johan@herland.net>,
	git@vger.kernel.org, Frank Lichtenheld <frank@lichtenheld.de>,
	Thomas Glanzmann <thomas@glanzmann.de>,
	Michael Gernoth <simigern@cip.informatik.uni-erlangen.de>
Subject: Re: [PATCH] git-archive: convert archive entries like checkouts do
Date: Sat, 19 May 2007 00:58:10 +0200	[thread overview]
Message-ID: <464E2F82.7090309@lsrfire.ath.cx> (raw)
In-Reply-To: <Pine.LNX.4.64.0705181826220.18541@iabervon.org>

Daniel Barkalow schrieb:
> Conditional needs a "+ 1", too.
[...]
> Same here.

Thank you for spotting this.  Fix-up patch below.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>

---
Embarrassing.  I'm off to go to sleep now.

 archive-tar.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/archive-tar.c b/archive-tar.c
index eb0abc7..33e7657 100644
--- a/archive-tar.c
+++ b/archive-tar.c
@@ -82,7 +82,7 @@ static void strbuf_append_string(struct strbuf *sb, const char *s)
 {
 	int slen = strlen(s);
 	int total = sb->len + slen;
-	if (total > sb->alloc) {
+	if (total + 1 > sb->alloc) {
 		sb->buf = xrealloc(sb->buf, total + 1);
 		sb->alloc = total + 1;
 	}
@@ -271,7 +271,7 @@ static int write_tar_entry(const unsigned char *sha1,
 		path.alloc = PATH_MAX;
 		path.len = path.eof = 0;
 	}
-	if (path.alloc < baselen + filenamelen) {
+	if (path.alloc < baselen + filenamelen + 1) {
 		free(path.buf);
 		path.buf = xmalloc(baselen + filenamelen + 1);
 		path.alloc = baselen + filenamelen + 1;

  reply	other threads:[~2007-05-18 22:58 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-17 16:38 Commit ID in exported Tar Ball Thomas Glanzmann
2007-05-17 16:57 ` Johan Herland
2007-05-17 17:11   ` Frank Lichtenheld
2007-05-17 17:14     ` Thomas Glanzmann
2007-05-17 17:28     ` Johan Herland
2007-05-18 22:09       ` [PATCH] git-archive: convert archive entries like checkouts do René Scharfe
2007-05-18 22:27         ` Daniel Barkalow
2007-05-18 22:58           ` René Scharfe [this message]
2007-05-19 20:22     ` Commit ID in exported Tar Ball René Scharfe
2007-05-19 21:00       ` Junio C Hamano
2007-05-19 21:39         ` A Large Angry SCM
2007-05-20  0:15         ` René Scharfe
2007-05-20 11:20           ` René Scharfe
2007-05-20  3:57         ` Shawn O. Pearce
2007-05-20 11:20           ` René Scharfe
2007-05-21  6:02             ` Shawn O. Pearce
2007-05-21 12:09               ` Petr Baudis
2007-05-21 19:54               ` René Scharfe
2007-05-22 22:26                 ` René Scharfe
2007-05-22 22:54                   ` Junio C Hamano
2007-05-22 23:44                     ` René Scharfe
2007-05-23  5:22                       ` Shawn O. Pearce
2007-05-20 11:20           ` René Scharfe
2007-05-20 16:10           ` Thomas Glanzmann
2007-05-20 16:28             ` Brian Gernhardt
2007-05-20 16:30               ` Thomas Glanzmann
2007-05-21  6:19                 ` Peter Baumann
2007-05-21  6:24                   ` Thomas Glanzmann
2007-05-21  6:29                 ` Shawn O. Pearce
2007-05-21  6:37                   ` Thomas Glanzmann
2007-05-21  6:53                     ` Shawn O. Pearce
2007-05-21  7:00                       ` Thomas Glanzmann
2007-05-21  6:56                     ` Brian Gernhardt
2007-05-21  7:02                       ` Thomas Glanzmann
2007-05-17 17:48   ` Frank Lichtenheld
2007-05-17 18:05     ` Johan Herland
2007-05-17 17:02 ` Kristian Høgsberg
2007-05-17 17:13   ` Thomas Glanzmann

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=464E2F82.7090309@lsrfire.ath.cx \
    --to=rene.scharfe@lsrfire.ath.cx \
    --cc=barkalow@iabervon.org \
    --cc=frank@lichtenheld.de \
    --cc=git@vger.kernel.org \
    --cc=johan@herland.net \
    --cc=junkio@cox.net \
    --cc=simigern@cip.informatik.uni-erlangen.de \
    --cc=thomas@glanzmann.de \
    /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).