提交 6f42d325 编写于 作者: J Jiri Denemark

bridge: Fix potential segfault when preparing dnsmasq arguments

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.
上级 3de82455
...@@ -426,7 +426,7 @@ networkBuildDnsmasqArgv(virNetworkObjPtr network, ...@@ -426,7 +426,7 @@ networkBuildDnsmasqArgv(virNetworkObjPtr network,
2 + /* --listen-address 10.0.0.1 */ 2 + /* --listen-address 10.0.0.1 */
(2 * network->def->nranges) + /* --dhcp-range 10.0.0.2,10.0.0.254 */ (2 * network->def->nranges) + /* --dhcp-range 10.0.0.2,10.0.0.254 */
/* --dhcp-lease-max=xxx if needed */ /* --dhcp-lease-max=xxx if needed */
(network->def->nranges ? 0 : 1) + (network->def->nranges ? 1 : 0) +
/* --dhcp-hostsfile=/var/lib/dnsmasq/$NAME.hostsfile */ /* --dhcp-hostsfile=/var/lib/dnsmasq/$NAME.hostsfile */
(network->def->nhosts > 0 ? 1 : 0) + (network->def->nhosts > 0 ? 1 : 0) +
/* --enable-tftp --tftp-root /srv/tftp */ /* --enable-tftp --tftp-root /srv/tftp */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册