qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-trivial] [PATCH 2/4] spice-qemu-char: fix check for in-paramet


From: Michael Tokarev
Subject: Re: [Qemu-trivial] [PATCH 2/4] spice-qemu-char: fix check for in-parameter
Date: Sun, 02 Nov 2014 09:50:11 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.2.0

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 <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");

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;
>      }
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]