[libvirt] [PATCH] fix a realloc problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



  The xen code for detaching devices had a mistake in the
resize compaction code, the size of the data copied was improper,
moving N bytes, instead of sizeof(device) * N  bytes.

  The attached patch by Dan Berrange fixes it, it's trivial
so I commited it,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/
diff -rup libvirt-0.6.2.orig/src/xm_internal.c libvirt-0.6.2.new/src/xm_internal.c
--- libvirt-0.6.2.orig/src/xm_internal.c	2009-04-03 15:04:28.000000000 +0100
+++ libvirt-0.6.2.new/src/xm_internal.c	2009-04-23 10:53:10.000000000 +0100
@@ -2912,7 +2912,8 @@ xenXMDomainDetachDevice(virDomainPtr dom
                 if (i < (def->ndisks - 1))
                     memmove(def->disks + i,
                             def->disks + i + 1,
-                            def->ndisks - (i + 1));
+                            sizeof(*def->disks) *
+                            (def->ndisks - (i + 1)));
                 break;
             }
         }
@@ -2929,7 +2930,8 @@ xenXMDomainDetachDevice(virDomainPtr dom
                 if (i < (def->nnets - 1))
                     memmove(def->nets + i,
                             def->nets + i + 1,
-                            def->nnets - (i + 1));
+                            sizeof(*def->nets) *
+                            (def->nnets - (i + 1)));
                 break;
             }
         }
--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]