diff options
author | Markus Armbruster <armbru@redhat.com> | 2015-07-01 13:13:54 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2015-09-04 15:47:13 +0200 |
commit | 1cf47a15f18312436c7fa2d97be5fbe6df0292f5 (patch) | |
tree | c44cc2b9ad9c98fd635f934d24e41ff0e0e49031 | |
parent | 016a335bd8ca624f43adbb08fa1698c29ec52a1a (diff) | |
download | hqemu-1cf47a15f18312436c7fa2d97be5fbe6df0292f5.zip hqemu-1cf47a15f18312436c7fa2d97be5fbe6df0292f5.tar.gz |
qapi: Reject -p arguments that break qapi-event.py
qapi-event.py breaks when you ask for a funny prefix like '@'.
Protect it.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
-rw-r--r-- | scripts/qapi.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/qapi.py b/scripts/qapi.py index ba11c54..bc3f4d3 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -1003,6 +1003,12 @@ def parse_command_line(extra_options = "", extra_long_options = []): for oa in opts: o, a = oa if o in ("-p", "--prefix"): + match = re.match('([A-Za-z_.-][A-Za-z0-9_.-]*)?', a) + if match.end() != len(a): + print >>sys.stderr, \ + "%s: 'funny character '%s' in argument of --prefix" \ + % (sys.argv[0], a[match.end()]) + sys.exit(1) prefix = a elif o in ("-o", "--output-dir"): output_dir = a + "/" |