[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-trivial] [PATCH 2/4] spice-qemu-char: fix check for in-parameter
From: |
zhanghailiang |
Subject: |
[Qemu-trivial] [PATCH 2/4] spice-qemu-char: fix check for in-parameter |
Date: |
Sat, 1 Nov 2014 09:50:01 +0800 |
For qemu_chr_open_spice_vmc and qemu_chr_open_spice_port, the in-parameter
never to be NULL, because the checks in qemu_chr_parse_spice_vmc
and qemu_chr_parse_spice_port have ensured this.
So we should check the length of the in-parameter.
Signed-off-by: zhanghailiang <address@hidden>
---
spice-qemu-char.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/spice-qemu-char.c b/spice-qemu-char.c
index 8106e06..45e7d69 100644
--- a/spice-qemu-char.c
+++ b/spice-qemu-char.c
@@ -290,7 +290,7 @@ CharDriverState *qemu_chr_open_spice_vmc(const char *type)
{
const char **psubtype = spice_server_char_device_recognized_subtypes();
- if (type == NULL) {
+ if (type == NULL || strlen(type) == 0) {
fprintf(stderr, "spice-qemu-char: missing name parameter\n");
print_allowed_subtypes();
return NULL;
@@ -315,7 +315,7 @@ CharDriverState *qemu_chr_open_spice_port(const char *name)
CharDriverState *chr;
SpiceCharDriver *s;
- if (name == NULL) {
+ if (name == NULL || strlen(name) == 0) {
fprintf(stderr, "spice-qemu-char: missing name parameter\n");
return NULL;
}
--
1.7.12.4