Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > ebe084c140192657f9094e135a84202c > files > 65

libvirt-0.8.2-29.el5.src.rpm

From 6a705b705bb890e694fb5071873604adbf26e161 Mon Sep 17 00:00:00 2001
Message-Id: <6a705b705bb890e694fb5071873604adbf26e161.1284409900.git.jdenemar@redhat.com>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Wed, 11 Aug 2010 17:47:18 +0200
Subject: [PATCH] bridge: Fix potential segfault when preparing dnsmasq arguments

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=630627

We add --dhcp-lease-max=xxx argument when network->def->nranges > 0 but
we only allocate space for in the opposite case :-) I guess we are lucky
enough to miscount somewhere else so that we actually allocate more
space than we need since no-one has hit this bug so far.
(cherry picked from commit 6f42d3253a05fc6c4d94d8d389019f956158c753)
---
 src/network/bridge_driver.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 80ed57a..b3f39de 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -426,7 +426,7 @@ networkBuildDnsmasqArgv(virNetworkObjPtr network,
         2 + /* --listen-address 10.0.0.1 */
         (2 * network->def->nranges) + /* --dhcp-range 10.0.0.2,10.0.0.254 */
         /* --dhcp-lease-max=xxx if needed */
-        (network->def->nranges ? 0 : 1) +
+        (network->def->nranges ? 1 : 0) +
         /* --dhcp-hostsfile=/var/lib/dnsmasq/$NAME.hostsfile */
         (network->def->nhosts > 0 ? 1 : 0) +
         /* --enable-tftp --tftp-root /srv/tftp */
-- 
1.7.2.2