]> xenbits.xensource.com Git - libvirt.git/commit
Power Hypervisor: fix potential segfault
authorMattias Bolte <matthias.bolte@googlemail.com>
Thu, 20 Aug 2009 10:32:19 +0000 (12:32 +0200)
committerChris Lalancette <clalance@redhat.com>
Thu, 20 Aug 2009 10:53:17 +0000 (12:53 +0200)
commit1aa1683377663b2ef494b8b851f55387627552e6
tree9c86465826a6930739f0d78046d74ea7d87962a9
parent2e7c8b0b6f26675f107eacc3cce24726de868fd1
Power Hypervisor: fix potential segfault

I came across this line in the phypOpen function:

char string[strlen(conn->uri->path)];

Here the path part of the given URI is used without checking it for
NULL, this can cause a segfault as strlen expects a string != NULL.
Beside that uuid_db and connection_data leak in case of an error.

In this line

conn->uri->path = string;

the original path of the URI leaks. The patch adds a VIR_FREE call
before setting the new path.

The attached patch is compile-tested but I don't have a Power
Hypervisor installation at hand to test it for real.

Matthias

Signed-off-by: Chris Lalancette <clalance@redhat.com>
src/phyp/phyp_driver.c