[libvirt] [PATCH] Robustify sexpr parser for NICs

# HG changeset patch # User john.levon@sun.com # Date 1233806614 28800 # Node ID 0b9d8336e5e089b19ac8381fdc77eadc72ef9eb7 # Parent 379763c63798c9f0c426facb9b9b61e34e6477e2 Robustify sexpr parser for NICs xend can occassionally get itself confused. Avoid crashing libvirt in this case. Signed-off-by: John Levon <john.levon@sun.com> diff --git a/src/xend_internal.c b/src/xend_internal.c --- a/src/xend_internal.c +++ b/src/xend_internal.c @@ -1759,7 +1759,8 @@ xenDaemonParseSxprNets(virConnectPtr con if (VIR_ALLOC(net) < 0) goto no_memory; - if (tmp != NULL || (STREQ(tmp2, DEFAULT_VIF_SCRIPT))) { + if (tmp != NULL || + (tmp2 != NULL && STREQ(tmp2, DEFAULT_VIF_SCRIPT))) { net->type = VIR_DOMAIN_NET_TYPE_BRIDGE; /* XXX virtual network reverse resolve */

john.levon@sun.com wrote:
Robustify sexpr parser for NICs
xend can occassionally get itself confused. Avoid crashing libvirt in this case.
diff --git a/src/xend_internal.c b/src/xend_internal.c --- a/src/xend_internal.c +++ b/src/xend_internal.c @@ -1759,7 +1759,8 @@ xenDaemonParseSxprNets(virConnectPtr con if (VIR_ALLOC(net) < 0) goto no_memory;
- if (tmp != NULL || (STREQ(tmp2, DEFAULT_VIF_SCRIPT))) { + if (tmp != NULL || + (tmp2 != NULL && STREQ(tmp2, DEFAULT_VIF_SCRIPT))) { net->type = VIR_DOMAIN_NET_TYPE_BRIDGE; /* XXX virtual network reverse resolve */
ACK, but it'd sure be nice to post an example of input that would crash libvirt. Bonus points for making it into a test case.

On Thu, Feb 05, 2009 at 06:56:58AM +0100, Jim Meyering wrote:
xend can occassionally get itself confused. Avoid crashing libvirt in this case.
The example I had looked like this: (device (vif (backend 0))) I'm not sure it's appropriate for a test case since it's strictly a bug. regards john

On Wed, Feb 04, 2009 at 08:12:49PM -0800, john.levon@sun.com wrote:
# HG changeset patch # User john.levon@sun.com # Date 1233806614 28800 # Node ID 0b9d8336e5e089b19ac8381fdc77eadc72ef9eb7 # Parent 379763c63798c9f0c426facb9b9b61e34e6477e2 Robustify sexpr parser for NICs
xend can occassionally get itself confused. Avoid crashing libvirt in this case.
Signed-off-by: John Levon <john.levon@sun.com>
ACk Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
participants (4)
-
Daniel P. Berrange
-
Jim Meyering
-
John Levon
-
john.levon@sun.com