[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]
Re: parent dir breaks Diversion
- From: Nobuyuki Tsuchimura <nospam@thanx>
- Date: Fri, 27 Apr 2001 15:00:26 +0900 (JST)
Hi,
> I found a bug in wml-2.1a1 (also in SNAP).
>
> ---- input
> <<head>>
> ..head>>This is OK.<<..
> <a href="../">Parent dir</a>
> ..head>>This is NG.<<..
> I made a patch, but I'm not good at perl,
> so please take care.
>
> --- /usr/lib/wml/exec/wml_p5_divert.orig Fri Apr 27 02:44:37 2001
> +++ /usr/lib/wml/exec/wml_p5_divert Fri Apr 27 02:52:35 2001
> @@ -203,9 +203,12 @@
> # calculate the minimum amount of plain characters we can skip
> my $l = length($remain);
> my $i1 = index($remain, '<<'); $i1 = ($i1 == -1 ? $l : $i1);
> - my $i2 = index($remain, '..');
> + my $i2 = -1;
> # Skip ../ which is often used in URLs
> - $i2 = $l if ($i2 == -1 or substr($remain, $i2+2, 1) eq '/');
> + do {
> + $i2 = index($remain, '..', $i2+1);
> + } while (substr($remain, $i2+2, 1) eq '/');
> + $i2 = $l if $i2 == -1;
Sorry, this patch causes an endless loop against a line starting with '/'.
I noticed in my bed. :-) I should have wrote as below.
+ } while ($i2 > -1 and substr($remain, $i2+2, 1) eq '/');
^^^^^^^^^^^^^
-- Regards,
Nobuyuki Tsuchimura
______________________________________________________________________
Website META Language (WML) www.engelschall.com/sw/wml/
Official Support Mailing List sw-wml@engelschall.com
Automated List Manager majordomo@engelschall.com