On Thu, 12 Dec 2002, Simon Wilcox wrote:

> On Thu, 12 Dec 2002, Shevek wrote:
> 
> > On Thu, 12 Dec 2002, Simon Wilcox wrote:
> > 
> > >     for my $part (@parts) {
> > >         next if $part eq $curdir;
> > >         if ($part eq $updir) {
> > >             die "Can't climb past start" unless (shift @canon);
> > 
> > No. Just shift @canon. /../.. is valid under Unix and it's equal to /. 
> > Failure to shift at root doesn't matter.
> 
> Remember that we're talking about web uris here. It is decided not OK to 
> go wandering around the file system. The server will stop it of course but 
> in my data cleansing operation I want to catch these problems.

Well you canonicalise your relative path then prepend your virtual root
path. pop(()) = (). So you can't go wandering around the filesystem
anyway doing this. As long as you prepend after canonicalisation not 
before.

S.

-- 
Shevek
I am the Borg.

sub AUTOLOAD{my$i=$AUTOLOAD;my$x=shift;$i=~s/^.*://;print"$x\n";eval
qq{*$AUTOLOAD=sub{my\$x=shift;return unless \$x%$i;&{$x}(\$x);};};}

foreach my $i (3..65535) { &{'2'}($i); }


Reply via email to