Browse code

do not allow dns_servers_no to be set higher than the number of DNS servers defined in /etc/resolv.conf

Miklos Tirpak authored on 13/02/2008 15:25:13
Showing 1 changed files
... ...
@@ -130,8 +130,9 @@ static int _resolv_init()
130 130
 		_res.retrans=cfg_get(core, core_cfg, dns_retr_time);
131 131
 	if (cfg_get(core, core_cfg, dns_retr_no)>0)
132 132
 		_res.retry=cfg_get(core, core_cfg, dns_retr_no);
133
-	if (cfg_get(core, core_cfg, dns_servers_no)>=0)
134
-		_res.nscount=cfg_get(core, core_cfg, dns_servers_no);
133
+	if ((cfg_get(core, core_cfg, dns_servers_no)>=0)
134
+		&& (cfg_get(core, core_cfg, dns_servers_no)<_res.nscount))
135
+			_res.nscount=cfg_get(core, core_cfg, dns_servers_no);
135 136
 	if (cfg_get(core, core_cfg, dns_search_list)==0)
136 137
 		_res.options&=~(RES_DEFNAMES|RES_DNSRCH);
137 138
 #else