summaryrefslogtreecommitdiffstats
path: root/discover/network.c
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2014-02-25 17:04:17 +0800
committerJeremy Kerr <jk@ozlabs.org>2014-02-25 20:55:21 +0800
commit9c950743461770220231d320db8c372aa74f9163 (patch)
treedfd7c4837190a51ce3ae3c5cddc666eaea5c1660 /discover/network.c
parentffb84fc1bf1d138d1ac1bb8ece0b7d625f288d97 (diff)
downloadpetitboot-9c950743461770220231d320db8c372aa74f9163.zip
petitboot-9c950743461770220231d320db8c372aa74f9163.tar.gz
discover/network: Fix incorrect static DNS servers in resolv.conf
We currently have a bug where we write NUL characters into /etc/resolv.conf, when using static DNS server configurations: With a network setting of: dns,9.0.6.11,9.0.7.1 We generate a resolv.conf containing: nameserver 9.0.6.11^@nameserver 9.0.7.1^@ This is due to an off-by-one bug when terminating the nameserver entries. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'discover/network.c')
-rw-r--r--discover/network.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/discover/network.c b/discover/network.c
index c300f3d..9acd4cb 100644
--- a/discover/network.c
+++ b/discover/network.c
@@ -533,7 +533,7 @@ static void network_init_dns(struct network *network)
buf = talloc_realloc(network, buf, char, len + dns_conf_len + 1);
memcpy(buf + len, dns_conf, dns_conf_len);
len += dns_conf_len;
- buf[len - 1] = '\0';
+ buf[len] = '\0';
modified = true;
talloc_free(dns_conf);
OpenPOWER on IntegriCloud