Ian Campbell
2011-Jun-23 15:34 UTC
[Xen-devel] [PATCH] libxl: correct allocation size in libxl_list_nics
# HG changeset patch # User Ian Campbell <ian.campbell@citrix.com> # Date 1308843248 -3600 # Node ID 18476e67178555b92b9bf893a3c550a9095caef8 # Parent 13048e166ab661e32269cd3abf8737a52e6229dd libxl: correct allocation size in libxl_list_nics The function returns a list of libxl_nicinfo not libxl_device_nic. Causes memory corruption on free. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> diff -r 13048e166ab6 -r 18476e671785 tools/libxl/libxl.c --- a/tools/libxl/libxl.c Thu Jun 23 15:26:59 2011 +0100 +++ b/tools/libxl/libxl.c Thu Jun 23 16:34:08 2011 +0100 @@ -1356,7 +1356,7 @@ libxl_nicinfo *libxl_list_nics(libxl_ctx libxl__sprintf(&gc, "%s/device/vif", dompath), &nb_nics); if (!l) goto err; - nics = res = calloc(nb_nics, sizeof (libxl_device_nic)); + nics = res = calloc(nb_nics, sizeof (libxl_nicinfo)); if (!res) goto err; for (*nb = nb_nics; nb_nics > 0; --nb_nics, ++l, ++nics) { _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Campbell
2011-Jul-14 15:59 UTC
[Xen-devel] [PATCH] libxl: correct allocation size in libxl_list_nics
# HG changeset patch # User Ian Campbell <ian.campbell@citrix.com> # Date 1310646155 -3600 # Node ID 725f44036b337a464866b3762d1136702ee05473 # Parent ff377f962b911578d4e5a7d4e700e74e7891b841 libxl: correct allocation size in libxl_list_nics The function returns a list of libxl_nicinfo not libxl_device_nic. Causes memory corruption on free. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> diff -r ff377f962b91 -r 725f44036b33 tools/libxl/libxl.c --- a/tools/libxl/libxl.c Thu Jul 14 13:22:35 2011 +0100 +++ b/tools/libxl/libxl.c Thu Jul 14 13:22:35 2011 +0100 @@ -1287,7 +1287,7 @@ libxl_nicinfo *libxl_list_nics(libxl_ctx libxl__sprintf(&gc, "%s/device/vif", dompath), &nb_nics); if (!l) goto err; - nics = res = calloc(nb_nics, sizeof (libxl_device_nic)); + nics = res = calloc(nb_nics, sizeof (libxl_nicinfo)); if (!res) goto err; for (*nb = nb_nics; nb_nics > 0; --nb_nics, ++l, ++nics) { _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel