mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-03-24 22:15:07 +00:00
qapi: Reject -p arguments that break qapi-event.py
qapi-event.py breaks when you ask for a funny prefix like '@'. Protect it. Backports commit 1cf47a15f18312436c7fa2d97be5fbe6df0292f5 from qemu
This commit is contained in:
parent
2c3f6e4175
commit
cf9d457200
|
@ -1001,6 +1001,12 @@ def parse_command_line(extra_options = "", extra_long_options = []):
|
||||||
for oa in opts:
|
for oa in opts:
|
||||||
o, a = oa
|
o, a = oa
|
||||||
if o in ("-p", "--prefix"):
|
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
|
prefix = a
|
||||||
elif o in ("-o", "--output-dir"):
|
elif o in ("-o", "--output-dir"):
|
||||||
output_dir = a + "/"
|
output_dir = a + "/"
|
||||||
|
|
Loading…
Reference in a new issue