From f4a3c8c79a664a46549bf91dbae534bcdabbf0ff Mon Sep 17 00:00:00 2001 From: David Freese Date: Fri, 15 Jun 2012 16:57:06 -0500 Subject: [PATCH] Corrupt filenames * Added code to subvert malign filenames contained in the wrapped file --- src/utils/wrap.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/utils/wrap.cxx b/src/utils/wrap.cxx index 101ab7a..d06b815 100644 --- a/src/utils/wrap.cxx +++ b/src/utils/wrap.cxx @@ -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 {