git-svn: avoid crashing svnserve when creating new directories
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> Confirmed-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <junkio@cox.net>
Eric Wong committed
May 19, 2007 at 02:58 UTC
6442754d6cc0056cf5b69b43d218f8b6d317e7f5
1 file changed
+2
git-svn.perl
+2
@@ -2841,8 +2841,10 @@ sub close_edit {
2841
my ($self) = @_;
2842
my ($p,$bat) = ($self->{pool}, $self->{bat});
2843
foreach (sort { $b =~ tr#/#/# <=> $a =~ tr#/#/# } keys %$bat) {
2844
+ next if $_ eq '';
2845
$self->close_directory($bat->{$_}, $p);
2846
}
2847
+ $self->close_directory($bat->{''}, $p);
2848
$self->SUPER::close_edit($p);
2849
$p->clear;
2850
}