[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 2/4] libxenstat: YAJL_GET_STRING may return NULL
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@xxxxxxxxxx> > Cc: Ian Campbell <ian.campbell@xxxxxxxxxx> > Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> > Cc: Charles Arnold <carnold@xxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> > --- > 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 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |