From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 1/2] spice: add sanity check for spice ports
Date: Wed, 20 Jul 2011 12:25:37 +0200 [thread overview]
Message-ID: <1311157538-12753-2-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1311157538-12753-1-git-send-email-kraxel@redhat.com>
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 <kraxel@redhat.com>
---
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
next prev parent reply other threads:[~2011-07-20 10:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-20 10:25 [Qemu-devel] [PULL] spice patch queue Gerd Hoffmann
2011-07-20 10:25 ` Gerd Hoffmann [this message]
2011-07-20 13:35 ` [Qemu-devel] [PATCH 1/2] spice: add sanity check for spice ports Alon Levy
2011-07-20 10:25 ` [Qemu-devel] [PATCH 2/2] qxl: upon reset, if spice worker is stopped, the command rings can be not empty Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1311157538-12753-2-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).