[libvirt] PATCH: Fix mem corruption after detaching Xen device

Daniel Veillard veillard at redhat.com
Thu Apr 23 15:09:43 UTC 2009


On Thu, Apr 23, 2009 at 02:48:49PM +0100, Daniel P. Berrange wrote:
> The XM driver's implementation of the 'detach device' command is causing
> memory corruption, but passing the wrong size information to memmove()
> by passing number of elements to move, instead of amount of memory to
> move. This patch fixes it

  ACK, serious bug, let's push it before 0.6.3

In general I would have felt safer if we could have used macros like for
memory allocation and freeing when growing and shrinking arrays,
especially when we switched from lists to arrays we added an awful lot
of similar code and using the size of the pointed object in macros
could have avoided this kind of problems I guess. If it can be used
to get malloc'ed size it should be able to work for realloc too I guess.
Maybe something to look at for next release, time permitting.

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list