fixed #331: Poco::Zip does not support files with .. in the name.

This commit is contained in:
Guenter Obiltschnig
2014-11-21 10:08:52 +01:00
parent 6ddce4c9ff
commit f09ed71a47
5 changed files with 25 additions and 10 deletions

View File

@@ -81,8 +81,8 @@ bool Decompress::handleZipEntry(std::istream& zipStream, const ZipLocalFileHeade
if (!_flattenDirs)
{
std::string dirName = hdr.getFileName();
if (dirName.find(ZipCommon::ILLEGAL_PATH) != std::string::npos)
throw ZipException("Illegal entry name " + dirName + " containing " + ZipCommon::ILLEGAL_PATH);
if (!ZipCommon::isValidPath(dirName))
throw ZipException("Illegal entry name " + dirName + " containing parent directory reference");
Poco::Path dir(_outDir, dirName);
dir.makeDirectory();
Poco::File aFile(dir);
@@ -101,8 +101,8 @@ bool Decompress::handleZipEntry(std::istream& zipStream, const ZipLocalFileHeade
fileName = p.getFileName();
}
if (fileName.find(ZipCommon::ILLEGAL_PATH) != std::string::npos)
throw ZipException("Illegal entry name " + fileName + " containing " + ZipCommon::ILLEGAL_PATH);
if (!ZipCommon::isValidPath(fileName))
throw ZipException("Illegal entry name " + fileName + " containing parent directory reference");
Poco::Path file(fileName);
file.makeFile();