From: "Jan Beulich" Subject: [PATCH] libxlu: don't crash on empty lists Date: Fri, 24 Apr 2015 10:04:31 +0100 Message-ID: <553A233F0200007800075802@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part0F3B6D0F.2__=" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YlZXD-0007Wk-Pn for xen-devel@lists.xenproject.org; Fri, 24 Apr 2015 09:04:31 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Ian Campbell , Ian Jackson , Wei Liu , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part0F3B6D0F.2__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Prior to 1a09c5113a ("libxlu: rework internal representation of setting") empty lists in config files did get accepted. Restore that behavior. Signed-off-by: Jan Beulich --- a/tools/libxl/libxlu_cfg.c +++ b/tools/libxl/libxlu_cfg.c @@ -397,7 +397,7 @@ XLU_ConfigValue *xlu__cfg_list_mk(CfgPar value =3D malloc(sizeof(*value)); if (!value) goto xe; value->type =3D XLU_LIST; - value->u.list.nvalues =3D 1; + value->u.list.nvalues =3D !!val; value->u.list.avalues =3D 1; value->u.list.values =3D values; memcpy(&value->loc, loc, sizeof(*loc)); --=__Part0F3B6D0F.2__= Content-Type: text/plain; name="libxlu-empty-list.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="libxlu-empty-list.patch" libxlu: don't crash on empty lists=0A=0APrior to 1a09c5113a ("libxlu: = rework internal representation of=0Asetting") empty lists in config files = did get accepted. Restore that=0Abehavior.=0A=0ASigned-off-by: Jan Beulich = =0A=0A--- a/tools/libxl/libxlu_cfg.c=0A+++ b/tools/libxl= /libxlu_cfg.c=0A@@ -397,7 +397,7 @@ XLU_ConfigValue *xlu__cfg_list_mk(CfgPa= r=0A value =3D malloc(sizeof(*value));=0A if (!value) goto xe;=0A = value->type =3D XLU_LIST;=0A- value->u.list.nvalues =3D 1;=0A+ = value->u.list.nvalues =3D !!val;=0A value->u.list.avalues =3D 1;=0A = value->u.list.values =3D values;=0A memcpy(&value->loc, loc, = sizeof(*loc));=0A --=__Part0F3B6D0F.2__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part0F3B6D0F.2__=--