fix relative path check, eliminate unused warnings

This commit is contained in:
Alex Fabijanic 2017-11-01 20:00:46 -05:00
parent f5b2cf3dd6
commit b09b32a3de
3 changed files with 6 additions and 7 deletions

View File

@ -23,7 +23,7 @@ namespace Zip {
bool ZipCommon::isValidPath(const std::string& path)
{
if (!Path(path).isRelative())
if (!Path(path).isRelative() || !Path(path, Path::PATH_WINDOWS).isRelative())
return false;
if (path == "..")
return false;

View File

@ -174,7 +174,6 @@ int ZipStreamBuf::readFromDevice(char* buffer, std::streamsize length)
// now push back the header to the stream, so that the ZipLocalFileHeader can read it
Poco::Int32 size = static_cast<Poco::Int32>(nfo.getFullHeaderSize());
_expectedCrc32 = nfo.getCRC32();
const char* rawHeader = nfo.getRawHeader();
_pIstr->seekg(-size, std::ios::cur);
if (!_pIstr->good()) throw Poco::IOException("Failed to seek on input stream");
if (!crcValid())

View File

@ -52,16 +52,16 @@ void ZipTest::testSkipSingleFile()
ZipLocalFileHeader hdr(inp, false, skip);
assert (ZipCommon::HS_FAT == hdr.getHostSystem());
int major = hdr.getMajorVersionNumber();
int minor = hdr.getMinorVersionNumber();
int POCO_UNUSED minor = hdr.getMinorVersionNumber();
assert (major <= 2);
std::size_t hdrSize = hdr.getHeaderSize();
assert (hdrSize > 30);
ZipCommon::CompressionMethod cm = hdr.getCompressionMethod();
ZipCommon::CompressionMethod POCO_UNUSED cm = hdr.getCompressionMethod();
assert (!hdr.isEncrypted());
Poco::DateTime aDate = hdr.lastModifiedAt();
Poco::UInt64 cS = hdr.getCompressedSize();
Poco::UInt64 uS = hdr.getUncompressedSize();
const std::string& fileName = hdr.getFileName();
Poco::UInt64 POCO_UNUSED cS = hdr.getCompressedSize();
Poco::UInt64 POCO_UNUSED uS = hdr.getUncompressedSize();
const std::string& POCO_UNUSED fileName = hdr.getFileName();
}