From: Michael Tokarev <mjt@tls.msk.ru>
To: zhanghailiang <zhang.zhanghailiang@huawei.com>, qemu-trivial@nongnu.org
Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, peter.huangpeng@huawei.com
Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH 2/4] spice-qemu-char: fix check for in-parameter
Date: Sun, 02 Nov 2014 09:50:11 +0300 [thread overview]
Message-ID: <5455D423.2000008@msgid.tls.msk.ru> (raw)
In-Reply-To: <1414806603-22556-3-git-send-email-zhang.zhanghailiang@huawei.com>
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.zhanghailiang@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;
> }
>
next prev parent reply other threads:[~2014-11-02 6:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-01 1:49 [Qemu-devel] [PATCH 0/4] Trivial patches about qemu-char zhanghailiang
2014-11-01 1:50 ` [Qemu-devel] [PATCH 1/4] qemu-char: fix parameter check for qemu_chr_open_pipe zhanghailiang
2014-11-02 5:18 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2014-11-03 2:59 ` zhanghailiang
2014-11-01 1:50 ` [Qemu-devel] [PATCH 2/4] spice-qemu-char: fix check for in-parameter zhanghailiang
2014-11-02 6:50 ` Michael Tokarev [this message]
2014-11-03 3:00 ` [Qemu-devel] [Qemu-trivial] " zhanghailiang
2014-11-01 1:50 ` [Qemu-devel] [PATCH 3/4] qemu-char: convert some open functions to use Error API zhanghailiang
2014-11-01 15:18 ` Eric Blake
2014-11-03 2:46 ` zhanghailiang
2014-11-01 1:50 ` [Qemu-devel] [PATCH 4/4] spice-qemu-char: convert " zhanghailiang
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=5455D423.2000008@msgid.tls.msk.ru \
--to=mjt@tls.msk.ru \
--cc=pbonzini@redhat.com \
--cc=peter.huangpeng@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=zhang.zhanghailiang@huawei.com \
/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).