Skip to content

Commit d2367b1

Browse files
white list the zipfile name as a valid pack when extracting
1 parent 8471b2e commit d2367b1

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/DownloadManager.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,22 @@ bool DownloadManager::InstallSmzip(const string &sZipFile)
101101
FAIL_M(static_cast<string>("Failed to mount " + sZipFile).c_str());
102102
vector<RString> v_packs;
103103
GetDirListing(TEMP_ZIP_MOUNT_POINT + "*", v_packs, true, true);
104-
if (v_packs.size() > 1)
105-
return false;
104+
105+
string doot = TEMP_ZIP_MOUNT_POINT;
106+
if (v_packs.size() > 1) {
107+
doot += sZipFile.substr(sZipFile.find_last_of("/") + 1);// attempt to whitelist pack name, this should be pretty simple/safe solution for a lot of pad packs -mina
108+
doot = doot.substr(0, doot.length() - 4) + "/";
109+
}
110+
106111
vector<string> vsFiles;
107112
{
108113
vector<RString> vsRawFiles;
109-
GetDirListingRecursive(TEMP_ZIP_MOUNT_POINT, "*", vsRawFiles);
114+
GetDirListingRecursive(doot, "*", vsRawFiles);
115+
116+
if (vsRawFiles.empty()) {
117+
FILEMAN->Unmount("zip", sZipFile, TEMP_ZIP_MOUNT_POINT);
118+
return false;
119+
}
110120

111121
vector<string> vsPrettyFiles;
112122
FOREACH_CONST(RString, vsRawFiles, s)

0 commit comments

Comments
 (0)