Corrupt filenames

* Added code to subvert malign filenames contained in
    the wrapped file
This commit is contained in:
David Freese 2012-06-15 16:57:06 -05:00
parent f2c88a0812
commit f4a3c8c79a

View file

@ -380,6 +380,16 @@ bool unwrapfile()
wrap_outshortname = wtext.substr(0, p);
wrap_outshortname.erase(0, strlen(wrap_fn));
wtext.erase(0,p+1);
// check for protocol abuse
if (wrap_outshortname.find('/') != string::npos || // linux path indicator
wrap_outshortname.find('\\') != string::npos || // windows path indicator
wrap_outshortname == "." || // current pwd path indicator
wrap_outshortname == ".." || // parent pwd path indicator
wrap_outshortname.find(":") || // windows drive indicator
wrap_outshortname.empty() ) { // null filename
errtext = "Filename corrupt, possible protocol abuse";
return false;
}
wrap_outfilename = wrap_foldername;
wrap_outfilename.append(wrap_outshortname);
} else {