From f576b352b48b93108b6d25af8dc224f98072f2a4 Mon Sep 17 00:00:00 2001 From: Oliver Chang Date: Fri, 12 May 2017 15:58:13 -0700 Subject: [PATCH] [helper] Add a check for valid project name when generating files. --- infra/helper.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/infra/helper.py b/infra/helper.py index 76635ba28..e9fcf6e49 100755 --- a/infra/helper.py +++ b/infra/helper.py @@ -40,6 +40,8 @@ BASE_IMAGES = [ 'gcr.io/oss-fuzz-base/base-runner-debug', ] +VALID_PROJECT_NAME_REGEX = re.compile(r'^[a-zA-Z0-9_-]+$') + def main(): os.chdir(OSSFUZZ_DIR) @@ -410,6 +412,10 @@ def reproduce(args): def generate(args): """Generate empty project files.""" + if not VALID_PROJECT_NAME_REGEX.match(args.project_name): + print('Invalid project name.', file=sys.stderr) + return 1 + dir = os.path.join('projects', args.project_name) try: