Skip to contentSkip to conversation

libxlu: don't crash on empty lists

PATCH In review Jan Beulich 2 participants 2 messages Apr 24, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxlu: don't crash on empty lists

Prior to 1a09c5113a ("libxlu: rework internal representation of setting") empty lists in config files did get accepted. Restore that behavior.

tools/libxl/libxlu_cfg.c +1 -1
@@ -397,7 +397,7 @@ XLU_ConfigValue *xlu__cfg_list_mk(CfgPar
     value = malloc(sizeof(*value));
     if (!value) goto xe;
     value->type = XLU_LIST;
-    value->u.list.nvalues = 1;
+    value->u.list.nvalues = !!val;
     value->u.list.avalues = 1;
     value->u.list.values = values;
     memcpy(&value->loc, loc, sizeof(*loc));

libxlu: don't crash on empty lists

Prior to 1a09c5113a ("libxlu: rework internal representation of setting") empty lists in config files did get accepted. Restore that behavior.

tools/libxl/libxlu_cfg.c +1 -1
@@ -397,7 +397,7 @@ XLU_ConfigValue *xlu__cfg_list_mk(CfgPar
     value = malloc(sizeof(*value));
     if (!value) goto xe;
     value->type = XLU_LIST;
-    value->u.list.nvalues = 1;
+    value->u.list.nvalues = !!val;
     value->u.list.avalues = 1;
     value->u.list.values = values;
     memcpy(&value->loc, loc, sizeof(*loc));

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel