Skip to content
This repository was archived by the owner on Aug 2, 2022. It is now read-only.

Throw exception when creating project with invalid identifier #370

Merged
merged 2 commits into from
Feb 1, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions tools/init/eosio-init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ int main(int argc, const char **argv) {

cl::ParseCommandLineOptions(argc, argv, std::string("eosio-proj"));
try {
if (!std::regex_match(project_name, std::regex("^[_a-zA-Z][_a-zA-Z0-9]*$"))) {
throw std::runtime_error("ERROR: invalid identifier: " + project_name + " (ensure that it is a valid C++ identifier)");
}
llvm::SmallString<128> rp;
std::string path = output_dir;
if (path.empty())
Expand Down