From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49269) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXrsB-00047D-4N for qemu-devel@nongnu.org; Fri, 04 Sep 2015 10:21:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXrs9-0001O5-Ur for qemu-devel@nongnu.org; Fri, 04 Sep 2015 10:21:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49777) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXrs9-0001Nx-Q9 for qemu-devel@nongnu.org; Fri, 04 Sep 2015 10:21:45 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 6910DC0AB66D for ; Fri, 4 Sep 2015 14:21:45 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-25.ams2.redhat.com [10.36.116.25]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t84ELhN3028211 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Fri, 4 Sep 2015 10:21:45 -0400 From: Markus Armbruster Date: Fri, 4 Sep 2015 16:21:12 +0200 Message-Id: <1441376500-14784-6-git-send-email-armbru@redhat.com> In-Reply-To: <1441376500-14784-1-git-send-email-armbru@redhat.com> References: <1441376500-14784-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PULL 05/33] qapi: Reject -p arguments that break qapi-event.py List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org qapi-event.py breaks when you ask for a funny prefix like '@'. Protect it. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- scripts/qapi.py | 6 ++++++ 1 file changed, 6 insertions(+) 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 + "/" -- 2.4.3