mirror of https://github.com/google/oss-fuzz.git
[helper] Add a check for valid project name when generating files.
This commit is contained in:
parent
c4054c4d8e
commit
f576b352b4
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue