From a5d0fd9c8a21af4a524ae60470c9381e94af446a Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Sun, 5 Feb 2017 19:39:30 +0000 Subject: [PATCH] Do not create directories . and .. --- Changelog.md | 1 + solc/CommandLineInterface.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 038d944f6..0c4e83294 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,6 +5,7 @@ Features: Bugfixes: * Commandline interface: Always escape filenames (replace ``/``, ``:`` and ``.`` with ``_``). + * Commandline interface: Do not try creating paths ``.`` and ``..``. * Type system: Disallow arrays with negative length. ### 0.4.9 (2017-01-31) diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 26355353a..6759727fe 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -461,7 +461,9 @@ void CommandLineInterface::createFile(string const& _fileName, string const& _da namespace fs = boost::filesystem; // create directory if not existent fs::path p(m_args.at(g_argOutputDir).as()); - fs::create_directories(p); + // Do not try creating the directory if the first item is . or .. + if (p.filename() != "." && p.filename() != "..") + fs::create_directories(p); string pathName = (p / _fileName).string(); ofstream outFile(pathName); outFile << _data;