01.11.2014 04:50, zhanghailiang wrote: > 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.
The same applies here as to qemu_chr_open in patch 1/4. But here we've one more thing: > Signed-off-by: zhanghailiang <zhang.zhanghaili...@huawei.com> > --- > 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"); This is 'missing TYPE parameter' not name. If we merge the check with qemu_chr_parse_* it will go away. Thanks, /mjt > 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; > } >