Packages: fix handling of unsafe paths in zips

This was breaking the P-51D which contains a mis-named PNG file which
tripped the unsafe path detection.
This commit is contained in:
James Turner
2020-03-24 13:51:57 +00:00
parent 73f00bd842
commit 8cf11f9208
3 changed files with 30 additions and 23 deletions
+3
View File
@@ -122,6 +122,9 @@ protected:
m_downloaded += n;
m_owner->installProgress(m_downloaded, responseLength());
m_extractor->extractBytes(ubytes, n);
if (m_extractor->hasError()) {
SG_LOG(SG_GENERAL, SG_WARN, "archive extraction failed");
}
}
void onDone() override
+4 -4
View File
@@ -59,7 +59,7 @@ public:
virtual void installProgress(pkg::InstallRef aInstall, unsigned int bytes, unsigned int total)
{
unsigned int percent = (bytes * 100) / total;
size_t percent = (static_cast<size_t>(bytes) * 100) / total;
if (percent == _lastPercent) {
return;
}
@@ -78,7 +78,7 @@ public:
}
private:
unsigned int _lastPercent;
size_t _lastPercent;
};
@@ -124,8 +124,8 @@ int main(int argc, char** argv)
{
HTTP::Client* http = new HTTP::Client();
pkg::Root* root = new pkg::Root(Dir::current().path(), "");
pkg::Root* root = new pkg::Root(Dir::current().path(), "2019.1.1");
MyDelegate dlg;
root->addDelegate(&dlg);