diff --git a/ChangeLog b/ChangeLog index 6eaa6f91..39f24ab8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2010-05-06 Tatsuhiro Tsujikawa + + Fixed the bug that name attribute of file element in Metalink file + is not properly sanitized. + * src/Metalink2RequestGroup.cc + * src/MetalinkParserController.cc + * test/Makefile.am + * test/Metalink2RequestGroupTest.cc + * test/metalink4-dosdirtraversal.xml + 2010-05-06 Tatsuhiro Tsujikawa Fixed the bug that if filename in Content-Disposition header diff --git a/src/Metalink2RequestGroup.cc b/src/Metalink2RequestGroup.cc index fb878315..bd86413a 100644 --- a/src/Metalink2RequestGroup.cc +++ b/src/Metalink2RequestGroup.cc @@ -290,8 +290,7 @@ Metalink2RequestGroup::createRequestGroup AccumulateNonP2PUri(uris)); SharedHandle fe (new FileEntry - (util::applyDir(option->get(PREF_DIR), - util::escapePath((*i)->file->getPath())), + (util::applyDir(option->get(PREF_DIR), (*i)->file->getPath()), (*i)->file->getLength(), offset, uris)); if(option->getAsBool(PREF_METALINK_ENABLE_UNIQUE_PROTOCOL)) { fe->disableSingleHostMultiConnection(); diff --git a/src/MetalinkParserController.cc b/src/MetalinkParserController.cc index 646d62af..9b725517 100644 --- a/src/MetalinkParserController.cc +++ b/src/MetalinkParserController.cc @@ -90,7 +90,7 @@ void MetalinkParserController::setFileNameOfEntry(const std::string& filename) std::string path = util::joinPath(elements.begin(), elements.end()); if(_tEntry->file.isNull()) { - _tEntry->file.reset(new FileEntry(path, 0, 0)); + _tEntry->file.reset(new FileEntry(util::escapePath(path), 0, 0)); } else { _tEntry->file->setPath(util::escapePath(path)); } diff --git a/test/Makefile.am b/test/Makefile.am index 9633909a..93115835 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -252,4 +252,5 @@ EXTRA_DIST = 4096chunk.txt\ metalink4.xml\ metalink3-dirtraversal.xml\ metalink4-groupbymetaurl.xml\ - serialize_session.meta4 + serialize_session.meta4\ + metalink4-dosdirtraversal.xml diff --git a/test/Makefile.in b/test/Makefile.in index 42b87b28..8afae727 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -691,7 +691,8 @@ EXTRA_DIST = 4096chunk.txt\ metalink4.xml\ metalink3-dirtraversal.xml\ metalink4-groupbymetaurl.xml\ - serialize_session.meta4 + serialize_session.meta4\ + metalink4-dosdirtraversal.xml all: all-am diff --git a/test/Metalink2RequestGroupTest.cc b/test/Metalink2RequestGroupTest.cc index 2cecb4aa..833e02b6 100644 --- a/test/Metalink2RequestGroupTest.cc +++ b/test/Metalink2RequestGroupTest.cc @@ -17,6 +17,7 @@ class Metalink2RequestGroupTest:public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(Metalink2RequestGroupTest); CPPUNIT_TEST(testGenerate); CPPUNIT_TEST(testGenerate_groupByMetaurl); + CPPUNIT_TEST(testGenerate_dosDirTraversal); CPPUNIT_TEST_SUITE_END(); private: SharedHandle