git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org, Matthieu Moy <Matthieu.Moy@imag.fr>
Subject: [PATCH] git-svn: avoid crashing svnserve when creating new directories
Date: Sat, 19 May 2007 02:58:37 -0700	[thread overview]
Message-ID: <20070519095837.GA387@muzzle> (raw)
In-Reply-To: <20070519061422.GA17528@muzzle>

When sorting directory names by depth (slash ("/") count) and
closing the deepest directories first (as the protocol
requires), we failed to put the root baton (with an empty string
as its key "") after top-level directories (which did not have
any slashes).

This resulted in svnserve being in a situation it couldn't
handle and caused a segmentation fault on the remote server.

This bug did not affect users of DAV and filesystem repositories.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 git-svn.perl |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index e38811a..6d0cdac 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -2841,8 +2841,10 @@ sub close_edit {
 	my ($self) = @_;
 	my ($p,$bat) = ($self->{pool}, $self->{bat});
 	foreach (sort { $b =~ tr#/#/# <=> $a =~ tr#/#/# } keys %$bat) {
+		next if $_ eq '';
 		$self->close_directory($bat->{$_}, $p);
 	}
+	$self->close_directory($bat->{''}, $p);
 	$self->SUPER::close_edit($p);
 	$p->clear;
 }
-- 
Eric Wong

  reply	other threads:[~2007-05-19  9:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-11  9:09 [BUG] git-svn dcommit fails (connection closed unexpectedly) Matthieu Moy
2007-05-11 11:27 ` Lars Hjemli
2007-05-11 11:30   ` Lars Hjemli
2007-05-11 12:51   ` Matthieu Moy
2007-05-14 18:13   ` Matthieu Moy
2007-05-19  6:14     ` Eric Wong
2007-05-19  9:58       ` Eric Wong [this message]
2007-05-19 10:19         ` [PATCH] git-svn: avoid crashing svnserve when creating new directories Matthieu Moy
2007-05-19 10:58           ` Eric Wong
2007-05-19 12:02             ` Matthieu Moy
2007-05-13 17:17 ` [BUG] git-svn dcommit fails (connection closed unexpectedly) Eric Wong
2007-05-13 17:49   ` Martin Eisenhardt
2007-05-13 18:24     ` Karl Hasselström
2007-05-13 21:01       ` Eric Wong
2007-05-14  0:39         ` Eric Wong
2007-05-14 17:26         ` Linus Torvalds
2007-05-14 17:50           ` Matthieu Moy
2007-05-14 12:27   ` Matthieu Moy

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=20070519095837.GA387@muzzle \
    --to=normalperson@yhbt.net \
    --cc=Matthieu.Moy@imag.fr \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /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).