[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]
parent dir breaks Diversion
- From: Nobuyuki Tsuchimura <nospam@thanx>
- Date: Fri, 27 Apr 2001 03:21:37 +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.<<..
---- output
This is OK.
<a href="../">Parent</a>
..head>>This is NG.
--- correct, I think.
This is OK.
This is NG.
<a href="../">Parent</a>
---
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;
my $i3 = index($remain, '{#'); $i3 = ($i3 == -1 ? $l : $i3);
my $i4 = index($remain, ':#'); $i4 = ($i4 == -1 ? $l : $i4);
One thing more, I think
$i1 = ($i1 == -1 ? $l : $i1);
is tricky. Isn't
$i1 = $l if $i1 == -1;
quicker and more readable?
-- 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