X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=lib%2Futil_file.cc;fp=lib%2Futil_file.cc;h=a7810c751da711135aa9b7e3caa7e501f446aca3;hb=4fd17e312a84a65a7604b81e4200ff2bcffc2488;hp=6c95440cfb655ef988c056f270c3ce54f0b5002a;hpb=7533318d8489db2dbf4736c5ed6e89702e123449;p=hmh%2Fhhml.git diff --git a/lib/util_file.cc b/lib/util_file.cc index 6c95440..a7810c7 100644 --- a/lib/util_file.cc +++ b/lib/util_file.cc @@ -100,6 +100,7 @@ void shapePath (ustring& path) { static uregex re1 ("//+"); static uregex re2 ("[^/]+/\\.\\.(/|$)"); static uregex re3 ("(/|^)\\.(/|$)"); + static uregex re4 ("^/\\.\\./"); umatch m; uiterator b, e; @@ -135,6 +136,10 @@ void shapePath (ustring& path) { assert (0); } } + while (usearch (path, m, re4)) { + e = path.end (); + path = ustring (m[0].second - 1, e); + } Bp1:; }