From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:38760) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QjWwK-0000sS-0T for qemu-devel@nongnu.org; Wed, 20 Jul 2011 09:35:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QjWwI-0000ot-0p for qemu-devel@nongnu.org; Wed, 20 Jul 2011 09:35:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33589) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QjWwH-0000oo-Nn for qemu-devel@nongnu.org; Wed, 20 Jul 2011 09:35:49 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6KDZmi5017693 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 20 Jul 2011 09:35:48 -0400 Date: Wed, 20 Jul 2011 16:35:29 +0300 From: Alon Levy Message-ID: <20110720133529.GF2346@bow.tlv.redhat.com> References: <1311157538-12753-1-git-send-email-kraxel@redhat.com> <1311157538-12753-2-git-send-email-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1311157538-12753-2-git-send-email-kraxel@redhat.com> Subject: Re: [Qemu-devel] [PATCH 1/2] spice: add sanity check for spice ports List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org On Wed, Jul 20, 2011 at 12:25:37PM +0200, Gerd Hoffmann wrote: > Make sure at least one port (port=.. or tls-port=...) > is specified. Also apply range checks to the port numbers. > > Signed-off-by: Gerd Hoffmann ACK. > --- > ui/spice-core.c | 11 ++++++++++- > 1 files changed, 10 insertions(+), 1 deletions(-) > > diff --git a/ui/spice-core.c b/ui/spice-core.c > index e142452..1100417 100644 > --- a/ui/spice-core.c > +++ b/ui/spice-core.c > @@ -480,7 +480,16 @@ void qemu_spice_init(void) > port = qemu_opt_get_number(opts, "port", 0); > tls_port = qemu_opt_get_number(opts, "tls-port", 0); > if (!port && !tls_port) { > - return; > + fprintf(stderr, "neither port nor tls-port specified for spice."); > + exit(1); > + } > + if (port < 0 || port > 65535) { > + fprintf(stderr, "spice port is out of range"); > + exit(1); > + } > + if (tls_port < 0 || tls_port > 65535) { > + fprintf(stderr, "spice tls-port is out of range"); > + exit(1); > } > password = qemu_opt_get(opts, "password"); > > -- > 1.7.1 > >