From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Wei Liu <wei.liu2@citrix.com>, xen-devel@lists.xen.org
Cc: Charles Arnold <carnold@suse.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Ian Campbell <ian.campbell@citrix.com>
Subject: Re: [PATCH 2/4] libxenstat: YAJL_GET_STRING may return NULL
Date: Wed, 8 Apr 2015 16:22:15 +0100 [thread overview]
Message-ID: <552547A7.5060608@citrix.com> (raw)
In-Reply-To: <1428505275-6563-3-git-send-email-wei.liu2@citrix.com>
On 08/04/15 16:01, Wei Liu wrote:
> Passing NULL to strcmp can cause segmentation fault. Continue in that
> case.
>
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> Cc: Ian Campbell <ian.campbell@citrix.com>
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Charles Arnold <carnold@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> tools/xenstat/libxenstat/src/xenstat_qmp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/xenstat/libxenstat/src/xenstat_qmp.c b/tools/xenstat/libxenstat/src/xenstat_qmp.c
> index f3aeec4..6bfbc2f 100644
> --- a/tools/xenstat/libxenstat/src/xenstat_qmp.c
> +++ b/tools/xenstat/libxenstat/src/xenstat_qmp.c
> @@ -110,7 +110,7 @@ static char *qmp_get_block_image(xenstat_node *node, char *qmp_devname, int qfd)
> ptr[0] = qblock[QMP_BLOCK_DEVICE]; /* "device" */
> if ((dev_obj = yajl_tree_get(n, ptr, yajl_t_any)) != NULL) {
> tmp = YAJL_GET_STRING(dev_obj);
> - if (strcmp(qmp_devname, tmp))
> + if (!tmp || strcmp(qmp_devname, tmp))
> continue;
> }
> else
next prev parent reply other threads:[~2015-04-08 15:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-08 15:01 [PATCH 0/4] libxenstat bug fixes and cleanups Wei Liu
2015-04-08 15:01 ` [PATCH 1/4] libxenstat: check xc_interface_open return value Wei Liu
2015-04-08 15:21 ` Andrew Cooper
2015-04-08 15:47 ` Wei Liu
2015-04-08 15:01 ` [PATCH 2/4] libxenstat: YAJL_GET_STRING may return NULL Wei Liu
2015-04-08 15:22 ` Andrew Cooper [this message]
2015-04-08 15:47 ` Ian Jackson
2015-04-08 15:01 ` [PATCH 3/4] libxenstat: always free qmp_stats Wei Liu
2015-04-08 15:49 ` Ian Jackson
2015-04-08 15:56 ` Wei Liu
2015-04-08 15:01 ` [PATCH 4/4] libxenstat: qmp_read fix and cleanup Wei Liu
2015-04-08 15:25 ` Andrew Cooper
2015-04-08 15:47 ` Wei Liu
2015-04-08 15:52 ` Ian Jackson
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=552547A7.5060608@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=carnold@suse.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.