This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-devel] [PATCH] libxl: correct allocation size in libxl_list_nics

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] libxl: correct allocation size in libxl_list_nics
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Thu, 14 Jul 2011 16:59:36 +0100
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Thu, 14 Jul 2011 09:03:33 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.6.4
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# 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@xxxxxxxxxx>

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), 
     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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] libxl: correct allocation size in libxl_list_nics, Ian Campbell <=